[PR #292] [CLOSED] Add Elasticsearch Tools Plugin for Dify Platform #784

Closed
opened 2026-02-22 17:38:29 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-plugins/pull/292
Author: @stoplyy
Created: 4/6/2025
Status: Closed

Base: mainHead: main


📝 Commits (4)

📊 Changes

1 file changed (+0 additions, -0 deletions)

View changed files

codersun/elasticsearch_tools/elasticsearch_tools.difypkg (+0 -0)

📄 Description

Description

This PR introduces the Elasticsearch Tools Plugin, a new plugin for the Dify platform that enables seamless interaction with Elasticsearch clusters. The plugin provides tools for managing Elasticsearch clusters, performing REST API calls, and executing various cluster operations.

Key Features:

  • Authentication: Supports username and password-based authentication for Elasticsearch clusters.
  • REST API Calls: Perform GET, POST, PUT, and DELETE operations on Elasticsearch clusters.
  • Cluster Operations:
    • Retrieve cluster health status.
    • Manage indices (mappings, settings, stats).
    • Execute search queries.
    • Perform custom REST API calls.
  • Flexible Configuration:
    • cluster_info: Map cluster names to their addresses.
    • auth_list: Map cluster names to their authentication credentials.

Files Added/Modified

Plugin Code:

  • provider/elasticsearch_tools.py: Implements the main provider logic for credential validation and cluster authentication.
  • tools/elasticsearch_rest.py: Implements the REST API tool logic for interacting with Elasticsearch clusters.
  • helper/auth_parser.py: Parses cluster and authentication information.
  • helper/elasticsearch_helper.py: Provides helper methods for Elasticsearch operations.

Plugin Configuration:

  • provider/elasticsearch_tools.yaml: Defines the plugin's metadata and credentials.
  • tools/elasticsearch_rest.yaml: Defines the REST API tool's parameters and outputs.

Documentation:

  • README.md: Provides an overview of the plugin, installation instructions, and usage examples.
  • PRIVACY.md: Details the plugin's data usage and privacy policy.

Assets:

  • _assets/icon.svg: Plugin icon representing Elasticsearch.

Installation Instructions

  1. Install dependencies:
    pip install -r requirements.txt
    
  2. Configure credentials in the platform:
    • cluster_info: JSON array mapping cluster names to addresses.
    • auth_list: JSON array mapping cluster names to authentication credentials.

Usage

Elasticsearch REST API Tool

  1. Perform a REST API call:
    • Specify cluster_name, endpoint, method, and body (if applicable).
    • Supports GET, POST, PUT, and DELETE methods.

Parameters:

  • cluster_name: The name of the Elasticsearch cluster to call (e.g., cluster_name_1).
  • endpoint: The API endpoint to call (e.g., _cluster/health).
  • method: The HTTP method to use (GET, POST, PUT, or DELETE).
  • body: The request body (optional, for POST and PUT methods).
  • timeout: The timeout for the request in seconds (default: 10).

Outputs:

  • success: Indicates whether the API call was successful.
  • error_message: Error message if the request failed.
  • result_object: The response as an object (if applicable).
  • result_array: The response as an array of objects (if applicable).
  • result_string: The response as a string (if applicable).

Testing

  • Unit tests are included to validate the functionality of the plugin components.
  • Mocking is used to simulate Elasticsearch cluster responses.

Privacy and Security

  • The plugin does not store or transmit user data outside the platform.
  • All data processing is performed temporarily during runtime.
  • Authentication credentials are securely managed by the platform.

Additional Notes

This plugin is designed to enhance the Dify platform by providing seamless integration with Elasticsearch clusters. It is a valuable addition for users who need to manage and interact with their Elasticsearch environments efficiently.

For more details, refer to the README.md file.


Checklist

  • Code follows the repository's coding standards.
  • Documentation is updated to reflect the new plugin.
  • Unit tests are included and pass successfully.
  • Plugin metadata and configuration files are validated.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langgenius/dify-plugins/pull/292 **Author:** [@stoplyy](https://github.com/stoplyy) **Created:** 4/6/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (4) - [`3910c96`](https://github.com/langgenius/dify-plugins/commit/3910c96c9b3d4700f5c92c084a7dcb898acb15ab) add elasticsearch tools - [`0f4f131`](https://github.com/langgenius/dify-plugins/commit/0f4f131c2d7eebd6928e0d1eed7515c6a297db82) Merge branch 'langgenius:main' into main - [`812653d`](https://github.com/langgenius/dify-plugins/commit/812653d3ef67dbe07d4424ff0bce3f39d9fb4966) change readme . url - [`7061dd9`](https://github.com/langgenius/dify-plugins/commit/7061dd929c81747fc1534d9e641262f0a4a0fa43) Merge branch 'main' of https://github.com/codersun-gpt/dify-plugins ### 📊 Changes **1 file changed** (+0 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `codersun/elasticsearch_tools/elasticsearch_tools.difypkg` (+0 -0) </details> ### 📄 Description ### Description This PR introduces the **Elasticsearch Tools Plugin**, a new plugin for the Dify platform that enables seamless interaction with Elasticsearch clusters. The plugin provides tools for managing Elasticsearch clusters, performing REST API calls, and executing various cluster operations. #### Key Features: - **Authentication**: Supports username and password-based authentication for Elasticsearch clusters. - **REST API Calls**: Perform GET, POST, PUT, and DELETE operations on Elasticsearch clusters. - **Cluster Operations**: - Retrieve cluster health status. - Manage indices (mappings, settings, stats). - Execute search queries. - Perform custom REST API calls. - **Flexible Configuration**: - `cluster_info`: Map cluster names to their addresses. - `auth_list`: Map cluster names to their authentication credentials. --- ### Files Added/Modified #### Plugin Code: - **`provider/elasticsearch_tools.py`**: Implements the main provider logic for credential validation and cluster authentication. - **`tools/elasticsearch_rest.py`**: Implements the REST API tool logic for interacting with Elasticsearch clusters. - **`helper/auth_parser.py`**: Parses cluster and authentication information. - **`helper/elasticsearch_helper.py`**: Provides helper methods for Elasticsearch operations. #### Plugin Configuration: - **`provider/elasticsearch_tools.yaml`**: Defines the plugin's metadata and credentials. - **`tools/elasticsearch_rest.yaml`**: Defines the REST API tool's parameters and outputs. #### Documentation: - **`README.md`**: Provides an overview of the plugin, installation instructions, and usage examples. - **`PRIVACY.md`**: Details the plugin's data usage and privacy policy. #### Assets: - **`_assets/icon.svg`**: Plugin icon representing Elasticsearch. --- ### Installation Instructions 1. Install dependencies: ```bash pip install -r requirements.txt ``` 2. Configure credentials in the platform: - `cluster_info`: JSON array mapping cluster names to addresses. - `auth_list`: JSON array mapping cluster names to authentication credentials. --- ### Usage #### Elasticsearch REST API Tool 1. Perform a REST API call: - Specify `cluster_name`, `endpoint`, `method`, and `body` (if applicable). - Supports GET, POST, PUT, and DELETE methods. #### Parameters: - **`cluster_name`**: The name of the Elasticsearch cluster to call (e.g., `cluster_name_1`). - **`endpoint`**: The API endpoint to call (e.g., `_cluster/health`). - **`method`**: The HTTP method to use (`GET`, `POST`, `PUT`, or `DELETE`). - **`body`**: The request body (optional, for POST and PUT methods). - **`timeout`**: The timeout for the request in seconds (default: 10). #### Outputs: - **`success`**: Indicates whether the API call was successful. - **`error_message`**: Error message if the request failed. - **`result_object`**: The response as an object (if applicable). - **`result_array`**: The response as an array of objects (if applicable). - **`result_string`**: The response as a string (if applicable). --- ### Testing - Unit tests are included to validate the functionality of the plugin components. - Mocking is used to simulate Elasticsearch cluster responses. --- ### Privacy and Security - The plugin does not store or transmit user data outside the platform. - All data processing is performed temporarily during runtime. - Authentication credentials are securely managed by the platform. --- ### Additional Notes This plugin is designed to enhance the Dify platform by providing seamless integration with Elasticsearch clusters. It is a valuable addition for users who need to manage and interact with their Elasticsearch environments efficiently. For more details, refer to the README.md file. --- ### Checklist - [x] Code follows the repository's coding standards. - [x] Documentation is updated to reflect the new plugin. - [x] Unit tests are included and pass successfully. - [x] Plugin metadata and configuration files are validated. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-22 17:38:29 -05:00
yindo closed this issue 2026-02-22 17:38:33 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugins#784