copied
Readme
Files and versions
Updated 8 months ago
elasticsearch
ElasticSearch Search
author: Jael
Description
The search operator runs a search via ElasticSearch client given a query. It takes a dictionary as input, which should be written in Query DSL. To use this operator, you need to set up ElasticSearch in advance.
Code Example
With an example ElasticSearch client 'localhost:9200',
search across the index 'test_index' using an example query {'match_all': {}}
to get all documents.
from towhee import pipe, ops, DataCollection
query = {'match_all': {}}
es_search = (
pipe.input('index_name', 'query')
.map(('index_name', 'query'), 'res', ops.elasticsearch.osschat_search(
host='localhost', port=9200
))
.output('query', 'res')
)
res = es_search('test_index', query)
DataCollection(res).show() # Optional: display output data
Factory Constructor
Create the operator via the following factory method:
elasticsearch.search(host='localhost', port=9200, user=None, password=None, ca_certs=None)
Parameters:
host: str
The host to connect ElasticSearch client.
port: int
The port to connect ElasticSearch client.
user: str
The username to connect ElasticSearch client if needed, defaults to None.
password: str
The user password to connect ElasticSearch client if needed, defaults to None.
ca_certs: str
The path to CA certificates to connect ElasticSearch client if needed, defaults to None.
Returns:
Search results wrapped by elastic_transport.ObjectApiResponse
.
More Resources
- Semantic Search with Milvus and OpenAI - Zilliz blog: In this guide, weâll explore semantic search capabilities through the integration of Milvus and OpenAIâs Embedding API, using a book title search as an example use case.
- Accelerate Similarity Search on Big Data with Vector Indexing - II - Zilliz blog: Discover how indexes dramatically accelerate vector similarity search, different types of indexes, and how to choose the right index for your next AI application.
- What Is Semantic Search?: Semantic search is a search technique that uses natural language processing (NLP) and machine learning (ML) to understand the context and meaning behind a user's search query.
- ArXiv Papers Vector Similarity Search with Milvus 2.1 - Zilliz blog: Run semantic search queries on ~640K papers in <50ms using Dask, SBERT SPECTRE, and Milvus Vector database
- Mastering BM25: A Deep Dive into the Algorithm and Its Application in Milvus - Zilliz blog: We can easily implement the BM25 algorithm to turn a document and a query into a sparse vector with Milvus. Then, these sparse vectors can be used for vector search to find the most relevant documents according to a specific query.
- The 2024 Playbook: Top Use Cases for Vector Search - Zilliz blog: An exploration of vector search technologies and their most popular use cases.
- Simplifying Legal Research with RAG, Milvus, and Ollama - Zilliz blog: In this blog post, we will see how we can apply RAG to Legal data. Legal research can be time-consuming. You usually need to review a large number of documents to find the answers you need. Retrieval-Augmented Generation (RAG) can help streamline your research process.
- Evolution of Search: From Keyword Matching to Vector Search and GenAI - Zilliz blog: Explores the evolution of search, the limitations of keyword-matching systems, and how vector search and GenAI are setting new standards for modern search.
| 8 Commits | ||
---|---|---|---|
|
1.1 KiB
|
2 years ago | |
|
4.2 KiB
|
8 months ago | |
|
106 B
|
2 years ago | |
|
1.5 KiB
|
2 years ago |