Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

172
Views
how to do exact match in elastic search?

I want to find exact match .if there is no match .I don't want to null.

I am search this id 6a8c283f-1e75-ec11-8943-000d3a15f525. it is giving me this output

  • fcf0dd4e-abbc-ec11-983f-0022482588e9

But these it is not matched only ec11 matched

I tried this search query

 result = await client.search({
          index: 'products',
          "query": {
            "match": {
              "sysid":sysid
            }
          }
        })
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The problem is because your sysid field is of type text and is thus analyzed at indexing time and tokenized into fcf0dd4e, abbc, ec11, 8943 and 000d3a15f525.

Also when searching using a match query, the searched term is analyzed as well into the following tokens 6a8c283f, 1e75, ec11, 8943, 000d3a15f525.

As you saw, the match works because ec11 matches.

For an exact match, what you need to do is to run your query against a keyword field instead. Maybe you're lucky and your mapping already contains a sysid.keyword sub-field. If not, you need to change your mapping and reindex your data.

Then you'll be able to run your term query like this and get your exact match:

  "term": {
     "sysid.keyword":sysid
  }
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!