Connecting to a content repository on Elasticsearch
Connect your agent to a content repository on an Elasticsearch instance.
Connecting to the Elasticsearch instance
Follow the steps to connect to an Elasticsearch instance:
- In the Knowledge section, go to Documents.
- Select Content repository, and click Connect content repository > Elasticsearch.
- In Elasticsearch url, enter the endpoint URL of the Elasticsearch cluster.
- In Elasticsearch port (optional), enter the port to connect to the Elasticsearch cluster.
- From Choose an authentication type, select
Basic authentication
orAPI key
.- If you select
Basic authentication
, you must provide a username and password. - If you select
API key
, you must provide the Elasticsearch API key.
- If you select
- Click Next.
Configuring the search index and result content
Configure the search index that index you want to access from your Elasticsearch instance and the fields that you want to map to return the search response:
-
In the Elasticsearch index, enter the Elasticsearch index name. Multiple indexes are not supported.
-
In the Configure result content section, map the fields of the specified index to the corresponding fields in the search response:
-
Title
Search result title. Use the title, name, or similar type of field from the collection as the search result title.
-
Body
Search result description. Use an abstract, summary, or highlight field from the collection as the search result body.
-
URL
This field can be populated with any footer content that you want to include at the end of the search result.
When you configure the query body in the Advanced Elasticsearch Settings to search the nested documents, you must ensure that the Title, Body, and URL are from the fields of the inner documents in your Elasticsearch index. For more information about using nested queries, see Configuring the query body for Elasticsearch.
-
Configuring custom filters for results and query body
Configure a custom filter to query results and a query body for Elasticsearch in the Advanced Elasticsearch settings section. This configuration is optional.
Configuring a custom filter for results from Elasticsearch
In the Configure the custom result filter for Elasticsearch (optional) field, you define the filter as an array of objects so that you can create filters to arrange the content per the query body. For more information, see Configuring custom filters for Elasticsearch.
Configuring a query body for Elasticsearch
In the Configure the query body for Elasticsearch (optional) field, enter the query body.
The query body is used to manipulate the user requests into a format that the search expects. It controls the query forms, search fields, filters and query size. In the REST API, the query body is an object that represents the POST
body for the _search
request to Elasticsearch. THe query body has a "$QUERY"
token to represent the customer's query, and a "$FILTER"
token to represent the array of filters that
are defined either in the search settings or at the step level.
By default, the integration with Elasticsearch uses keyword search, but you can configure the query body as an advanced Elasticsearch setting in your agents to enable more advanced search techniques, such as:
- Semantic search with ELSER.
- k-nearest neighbor (kNN) dense vector search.
- Nested query to search nested documents.
- Hybrid search.
- Search on a semantic text field.
For more information about using different types of query body examples, see Configuring query body for Elasticsearch.
For more information about the Elasticsearch _search
API request body, see Elasticsearch search API request body in Elasticsearch documentation.
What to do next
After you connect to Elasticsearch, you can modify the repository connection data or the settings you provided to fetch the documents.
Also, if you want to fine tune how your agent uses the search results, see Editing the settings of the search results.