Add Elasticsearch Tools Plugin for Dify Platform #292
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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
cluster_info
: JSON array mapping cluster names to addresses.auth_list
: JSON array mapping cluster names to authentication credentials.Usage
Elasticsearch REST API Tool
cluster_name
,endpoint
,method
, andbody
(if applicable).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
, orDELETE
).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
Privacy and Security
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