ElasticSearch Match_Phrase Query not full text match

380 Views Asked by At

I used match_phrase query for search full text matching.

But it did not work as I thought.

Does match_phrase query not work with text type?

My query:

GET my_index/_search
{
      "query": {
        "match_phrase" : {
            "message" : "Login"
        }
    }
}

Search Result:

"hits": [
  {
    "_index": "my_index",
    "_source": {
      "message": "Login success"
    }
  },
  {
    "_index": "my_index",
    "_source": {
      "message": "Login operator1"
    }
  },
  {
    "_index": "my_index",
    "_source": {
      "message": "Login failed"
    }
  }
]

My mapping:

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

Help.

0

There are 0 best solutions below