How to search for specific word and exact match in Elasticsearch

sample data for title

actiontype test
booleanTest
test-demo
test_demo
Test new account object
sync accounts data test

default Mapping for title

"title": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
 },

tried with this query search

{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "title": "test"
          }
        }
      ]
    }
  },
}

here my expectation

with specific word(e.g. : test ) it should return following titles

expect
        actiontype test
        booleanTest
        test-demo
        test_demo
        Test new account object
        sync accounts data test

But

got
            actiontype test
            test-demo
            test_demo
            Test new account object
            sync accounts data test

With exact match (e.g. : sync accounts data test ) it should return only this(sync accounts data test) but got all records those contains this words (sync,account,data,test).

What should I do to make this happen ? Thanks.

Welcome!

Try with:

{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "title.keyword": "test"
          }
        }
      ]
    }
  }

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