package
0.29.0-beta
Repository: https://github.com/instill-ai/component.git
Documentation: pkg.go.dev

# README


title: "Elasticsearch" lang: "en-US" draft: false description: "Learn about how to set up a VDP Elasticsearch component https://github.com/instill-ai/instill-core"

The Elasticsearch component is a data component that allows users to access the Elasticsearch database. It can carry out the following tasks:

Release Stage

Alpha

Configuration

The component definition and tasks are defined in the definition.json and tasks.json files respectively.

Setup

In order to communicate with Elastic, the following connection details need to be provided. You may specify them directly in a pipeline recipe as key-value pairs within the component's setup block, or you can create a Connection from the Integration Settings page and reference the whole setup as setup: ${connection.<my-connection-id>}.

FieldField IDTypeNote
Cloud ID (required)cloud-idstringFill in the Cloud ID for the Elasticsearch instance
API Key (required)api-keystringFill in the API key for the Elasticsearch instance (please use encoded one)

Supported Tasks

Search

Search for documents in Elasticsearch, support full text search

InputIDTypeDescription
Task ID (required)taskstringTASK_SEARCH
Index Name (required)index-namestringName of the Elasticsearch index
IDidstringThe ID of the document
QueryquerystringFull text search query for search task, query will be prioritised over filter if both are provided, if both query and filter are not provided, all documents will be selected
FilterfilterobjectThe query dsl filter which starts with "query" field, please refer to here.
Filter SQLfilter-sqlstringThe filter to be applied to the data with SQL syntax, which starts with WHERE clause, empty for no filter
SizesizeintegerNumber of documents to return. If empty then all documents will be returned
Fieldsfieldsarray[string]The fields to return in the documents. If empty then all fields will be returned
Minimum Scoremin-scorenumberMinimum score to consider for search results. If empty then no minimum score will be considered
OutputIDTypeDescription
StatusstatusstringSearch operation status
ResultresultobjectResult of the search operation
Output Objects in Search

Result

FieldField IDTypeNote
DatadataarrayThe data returned from the search operation
DocumentsdocumentsarrayThe documents returned from the search operation
IDsidsarrayThe ids returned from the search operation

Vector Search

Search for vector similarity search in Elasticsearch

InputIDTypeDescription
Task ID (required)taskstringTASK_VECTOR_SEARCH
Index Name (required)index-namestringName of the Elasticsearch index
Field (required)fieldstringField name of the vector to search for similar vectors
Query Vectorquery-vectorarray[number]Query vector to search for similar vectors
KkintegerK of documents to do kNN vector search
Num Candidatesnum-candidatesintegerNumber of candidates to be considered for kNN vector search. Default to 2 times of k
FilterfilterobjectThe query dsl filter which starts with "filter" field, please refer to here.
Filter SQLfilter-sqlstringThe filter to be applied to the data with SQL syntax, which starts with WHERE clause, empty for no filter
Fieldsfieldsarray[string]The fields to return in the documents. If empty then all fields will be returned
Minimum Scoremin-scorenumberMinimum score to consider for search results. If empty then no minimum score will be considered
OutputIDTypeDescription
StatusstatusstringSearch operation status
ResultresultobjectResult of the vector search operation
Output Objects in Vector Search

Result

FieldField IDTypeNote
DocumentsdocumentsarrayThe documents returned from the vector search operation
IDsidsarrayThe ids returned from the vector search operation
MetadatametadataarrayThe metadata returned from the vector search operation
VectorsvectorsarrayThe vectors returned from the vector search operation

Index

Index a document into Elasticsearch

InputIDTypeDescription
Task ID (required)taskstringTASK_INDEX
Index Name (required)index-namestringName of the Elasticsearch index
IDidstringThe ID of the document
Data (required)dataobjectData to be indexed
OutputIDTypeDescription
StatusstatusstringIndex operation status

Multi Index

Index multiple documents into Elasticsearch with bulk API

InputIDTypeDescription
Task ID (required)taskstringTASK_MULTI_INDEX
Index Name (required)index-namestringName of the Elasticsearch index
Array IDarray-idarray[string]The array of id
Array Data (required)array-dataarray[object]Array data to be indexed
OutputIDTypeDescription
StatusstatusstringIndex operation status

Update

Update a document in Elasticsearch

InputIDTypeDescription
Task ID (required)taskstringTASK_UPDATE
Index Name (required)index-namestringName of the Elasticsearch index
IDidstringThe ID of the document
QueryquerystringFull text search query for update task, query will be prioritised over filter if both are provided, if both query and filter are not provided, all documents will be selected
FilterfilterobjectThe query dsl filter which starts with "query" field, please refer to here.
Filter SQLfilter-sqlstringThe filter to be applied to the data with SQL syntax, which starts with WHERE clause, empty for no filter
Update (required)update-dataobjectUpdate data
OutputIDTypeDescription
StatusstatusstringUpdate operation status

Delete

Delete documents from Elasticsearch

InputIDTypeDescription
Task ID (required)taskstringTASK_DELETE
Index Name (required)index-namestringName of the Elasticsearch index
IDidstringThe ID of the document
QueryquerystringFull text search query for delete task, query will be prioritised over filter if both are provided, if both query and filter are not provided, all documents will be selected
FilterfilterobjectThe query dsl filter which starts with "query" field, please refer to here.
Filter SQLfilter-sqlstringThe filter to be applied to the data with SQL syntax, which starts with WHERE clause, empty for no filter
OutputIDTypeDescription
StatusstatusstringDelete operation status

Create Index

Create an index in Elasticsearch

InputIDTypeDescription
Task ID (required)taskstringTASK_CREATE_INDEX
Index Name (required)index-namestringName of the Elasticsearch index
MappingsmappingsobjectIndex mappings which starts with {"mappings":{"properties"}} field, please refer to here for vector search and here for other mappings.
OutputIDTypeDescription
StatusstatusstringCreate index operation status

Delete Index

Delete an index in Elasticsearch

InputIDTypeDescription
Task ID (required)taskstringTASK_DELETE_INDEX
Index Name (required)index-namestringName of the Elasticsearch index
OutputIDTypeDescription
StatusstatusstringDelete index operation status

# Functions

mappings refer to elasticsearch documentation for more information, use dense_vector type with similarity and dims fields pre-defined mappings is mandatory for vector search, if index isnt created with mappings, vector search will not work as dense_vector type doesn't explicitly defined.
No description provided by the author
No description provided by the author
No description provided by the author
Init returns an implementation of IConnector that interacts with Elasticsearch.
No description provided by the author
size is optional, empty means all documents min-score is optional, empty means no minimum score fields is optional, empty means all fields filter is optional, empty means no filter, choose one (id, filter, or filter-sql) id is optional, empty means no id, choose one (id, filter, or filter-sql) filter-sql is optional, empty means no filter-sql, choose one (id, filter, or filter-sql) query is optional, empty means no query, only for full text search.
No description provided by the author
Only support vector search for now, for semantic search, we can use external model on other component combined with vector search size is optional, empty means all documents source-only, if true will return only source of documents, if false will return all fields (_id, _index, _score, _source) min-score is optional, empty means no minimum score fields is optional, empty means all fields filter is optional, empty means no filter.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author