langchain/templates/elastic-query-generator
David Duong d39b4b61b6
Batch apply poetry lock --no-update for all templates (#12531)
Ran the following bash script for all templates

```bash
#!/bin/bash

set -e
current_dir="$(pwd)"
for directory in */; do
    if [ -d "$directory" ]; then
        (cd "$directory" && poetry lock --no-update)
    fi
done

cd "$current_dir"
```

Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-10-30 15:18:53 -07:00
..
elastic_query_generator notebook fmt (#12498) 2023-10-29 15:50:09 -07:00
tests Templates (#12294) 2023-10-25 18:47:42 -07:00
ingest.py notebook fmt (#12498) 2023-10-29 15:50:09 -07:00
main.py Format Templates (#12396) 2023-10-26 19:44:30 -07:00
poetry.lock Batch apply poetry lock --no-update for all templates (#12531) 2023-10-30 15:18:53 -07:00
pyproject.toml various templates improvements (#12500) 2023-10-28 22:13:22 -07:00
README.md various templates improvements (#12500) 2023-10-28 22:13:22 -07:00

elastic-query-generator

We can use LLMs to interact with Elasticsearch analytics databases in natural language.

This chain builds search queries via the Elasticsearch DSL API (filters and aggregations).

The Elasticsearch client must have permissions for index listing, mapping description and search queries.

Setup

Installing Elasticsearch

There are a number of ways to run Elasticsearch.

Elastic Cloud

Create a free trial account on Elastic Cloud.

With a deployment, update the connection string.

Password and connection (elasticsearch url) can be found on the deployment console. Th

Populating with data

If you want to populate the DB with some example info, you can run python ingest.py.

This will create a customers index. In the chain, we specify indexes to generate queries against, and we specify ["customers"]. This is specific to setting up your Elastic index in this