Performing semantic searches - ELSER

I am new to Elastic and I am sure my issue is very basic, if someone could give me high level pointers (or detailed instructions if they wish) it would be very helpful.

I have about 120,000 documents and each document has a property called "tx"

I want to perform semantic searches against the tx property of the document.

My questions

  1. how do I setup the index and the mappings
  2. how do I structure the documents for ingestion, does it need any additional property to support ELSER
  3. after ingesting documents do I need to reindex?
  4. how do I structure my query.



I think that a good starting page would be this one: Tutorial: semantic search with ELSER | Elasticsearch Guide [8.12] | Elastic

What language are you using? We have more content and examples in python - check out the notebooks here on searchlabs

To answer your specifics:

  • If you already have your data in an index, you can create a new "target" index and use a pipeline to re-index all your documents with the new embedding values stored in a sparse-vector field.
  • Alternatively, if your data comes from a different source, you can directly index it using ELSER enhancements in one go during the initial ingestion.
  • For queries, you will be using the text_expansion to perform semantic search:
"text_expansion": {
                    "ml.tokens": {
                        "model_text":"looking for a specific document in here"

Good luck!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.