Elasticsearch
Last updated
Last updated
Elasticsearch is a robust search engine designed for quick and efficient data retrieval in applications. It handles diverse data types, employs a distributed architecture, and offers a powerful query language for real-time search needs. Integration into your applications enhances search experiences, enabling developers to implement efficient full-text searches and complex queries. Elasticsearch's indexing capabilities make it valuable for applications such as monitoring systems, log analysis tools, and other scenarios requiring fast and relevant data access.
Below is a video for our OpenSearch functionality, which can be used as a reference when working with our Elasticsearch functions; they are largely the same.
Xano offers a few functions to make Elasticsearch requests simple.
Requires an Elasticsearch domain.
auth_type
Choose between Basic
, Bearer
or API Key
to set the type of authentication process to use.
key_id
If using Basic
, enter the username you wish to authenticate with.
If using Bearer
, leave this blank.
If using API Key
, enter the API key identifier you wish to authenticate with.
access_key
If using Basic
, enter the API key secret you with to authenticate with.
If using Bearer
, no access key is required.
If using API Key
, enter the value that corresponds with the key identifier you wish to authenticate with.
base_url
Set to the domain endpoint where Elasticsearch is hosted.
index
Enter the name of the Elasticsearch index to send request.
Only applicable on Document and Query functions.
Use the query wizard to easily search documents stored in Elasticsearch.
See Connect to Elasticsearch for details on configuration.
Then, select a return_type
from the options below.
search
- Returns records that match query
count
- Returns number of total records matching query
Query Wizard
Set filter criteria using the Xano query builder. The left input is the field to filter on. Then set the operator and value to evaluate. Optionally, add multiple conditions using AND / OR logic.
Select ‘Update Payload’ to ensure your changes are reflected in the query payload.
Output Options
These options can only be set on ‘search’ return type (not ‘count’).
Size: the number of results to return (useful for pagination)
From: the number to offset the results (useful for pagination)
Included Fields: field names to include in the results. Can be formatted as JSON array or comma separated string.
Sort: order to return results. Default is by Elasticsearch relevance score. Option to choose one or more fields to sort in ascending or descending order.
Payload (auto-generated)
The JSON sent as the payload to Elasticsearch. This is generated by the Query Wizard and Output Options sections. Useful for debugging.
Dynamic values (variables, inputs, etc.) are escaped using parentheses and use Xano expression syntax. These will be evaluated at the time of the request.
Changes made directly to the payload may be overwritten by other areas of the query wizard. If you already have a query payload you want to use, it is recommended to use the Elasticsearch Request function instead.
Easily get, add, update, or remove documents from an Elasticsearch index.
See Connect to Elasticsearch for details on configuration.
Set method of API request to GET
Specify doc_id
Set method
to POST
(create) or PUT
(update)
Set doc_id
(optional for POST)
Send any Elasticsearch API request using similar configuration methods as outlined in Connect to Elasticsearch.
Set the url
to use the desired endpoint of the request.
Set query
to the JSON payload if necessary.