mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-05-02 03:00:36 -04:00
feat(sources/elasticsearch): add Elasticsearch source and tools (#1109)
Add support for Elasticsearch with the following tools: * search * esql * get_mappings * list_indices This PR fixes #859 --------- Co-authored-by: duwenxin <duwenxin@google.com> Co-authored-by: Wenxin Du <117315983+duwenxin99@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
d7f68ebb1a
commit
5367285e91
68
docs/en/resources/sources/elasticsearch.md
Normal file
68
docs/en/resources/sources/elasticsearch.md
Normal file
@@ -0,0 +1,68 @@
|
||||
---
|
||||
title: "Elasticsearch"
|
||||
type: docs
|
||||
weight: 1
|
||||
description: >
|
||||
Elasticsearch is a distributed, free and open search and analytics engine
|
||||
for all types of data, including textual, numerical, geospatial, structured,
|
||||
and unstructured.
|
||||
---
|
||||
|
||||
# Elasticsearch Source
|
||||
|
||||
[Elasticsearch][elasticsearch-docs] is a distributed, free and open search and analytics engine
|
||||
for all types of data, including textual, numerical, geospatial, structured,
|
||||
and unstructured.
|
||||
|
||||
If you are new to Elasticsearch, you can learn how to
|
||||
[set up a cluster and start indexing data][elasticsearch-quickstart].
|
||||
|
||||
Elasticsearch uses [ES|QL][elasticsearch-esql] for querying data. ES|QL
|
||||
is a powerful query language that allows you to search and aggregate data in
|
||||
Elasticsearch.
|
||||
|
||||
See the [official documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html) for more information.
|
||||
|
||||
[elasticsearch-docs]: https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
|
||||
[elasticsearch-quickstart]: https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started.html
|
||||
[elasticsearch-esql]: https://www.elastic.co/guide/en/elasticsearch/reference/current/esql.html
|
||||
|
||||
## Available Tools
|
||||
|
||||
- [`elasticsearch-esql`](../tools/elasticsearch/elasticsearch-esql.md)
|
||||
Execute ES|QL queries.
|
||||
|
||||
## Requirements
|
||||
|
||||
### API Key
|
||||
|
||||
Toolbox uses an [API key][api-key] to authorize and authenticate when
|
||||
interacting with [Elasticsearch][elasticsearch-docs].
|
||||
|
||||
In addition to [setting the API key for your server][set-api-key], you need to
|
||||
ensure the API key has the correct permissions for the queries you intend to
|
||||
run. See [API key management][api-key-management] for more information on
|
||||
applying permissions to an API key.
|
||||
|
||||
[api-key]: https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html
|
||||
[set-api-key]: https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html
|
||||
[api-key-management]: https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-api-key.html
|
||||
|
||||
## Example
|
||||
|
||||
```yaml
|
||||
sources:
|
||||
my-elasticsearch-source:
|
||||
kind: "elasticsearch"
|
||||
addresses:
|
||||
- "http://localhost:9200"
|
||||
apikey: "my-api-key"
|
||||
```
|
||||
|
||||
## Reference
|
||||
|
||||
| **field** | **type** | **required** | **description** |
|
||||
|-----------|:--------:|:------------:|-------------------------------------------------------------------------------|
|
||||
| kind | string | true | Must be "elasticsearch". |
|
||||
| addresses | []string | true | List of Elasticsearch hosts to connect to. |
|
||||
| apikey | string | true | The API key to use for authentication. |
|
||||
7
docs/en/resources/tools/elasticsearch/_index.md
Normal file
7
docs/en/resources/tools/elasticsearch/_index.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: "Elasticsearch"
|
||||
type: docs
|
||||
weight: 1
|
||||
description: >
|
||||
Tools that work with Elasticsearch Sources.
|
||||
---
|
||||
45
docs/en/resources/tools/elasticsearch/elasticsearch-esql.md
Normal file
45
docs/en/resources/tools/elasticsearch/elasticsearch-esql.md
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
title: "elasticsearch-esql"
|
||||
type: docs
|
||||
weight: 2
|
||||
description: >
|
||||
Execute ES|QL queries.
|
||||
---
|
||||
|
||||
# elasticsearch-esql
|
||||
|
||||
Execute ES|QL queries.
|
||||
|
||||
This tool allows you to execute ES|QL queries against your Elasticsearch
|
||||
cluster. You can use this to perform complex searches and aggregations.
|
||||
|
||||
See the [official documentation](https://www.elastic.co/docs/reference/query-languages/esql/esql-getting-started) for more information.
|
||||
|
||||
## Example
|
||||
|
||||
```yaml
|
||||
tools:
|
||||
query_my_index:
|
||||
kind: elasticsearch-esql
|
||||
source: elasticsearch-source
|
||||
description: Use this tool to execute ES|QL queries.
|
||||
query: |
|
||||
FROM my-index
|
||||
| KEEP *
|
||||
| LIMIT ?limit
|
||||
parameters:
|
||||
- name: limit
|
||||
type: integer
|
||||
description: Limit the number of results.
|
||||
required: true
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| **name** | **type** | **required** | **description** |
|
||||
|------------|:--------:|:------------:|-----------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| query | string | false | The ES\|QL query to run. Can also be passed by parameters. |
|
||||
| format | string | false | The format of the query. Default is json. Valid values are csv, json, tsv, txt, yaml, cbor, smile, or arrow. |
|
||||
| timeout | integer | false | The timeout for the query in seconds. Default is 60 (1 minute). |
|
||||
| parameters | [parameters](../#specifying-parameters) | false | List of [parameters](../#specifying-parameters) that will be used with the ES\|QL query.<br/>Only supports “string”, “integer”, “float”, “boolean”. |
|
||||
|
||||
Reference in New Issue
Block a user