Match query does not give expected result


I am not sure if I am doing something wrong, but I cant see expected results for match query.
I have followed ES documents and tried making a curl request with below json body

    "query": {
        "match" : {
            "title" : {
                "query" : "this test",
                "operator" : "or"

Complete title value is: "this is a test". Though when I make a call using below equivalent bool query, I am getting results:

"query" :{
  "bool": {
"should": [
  { "term": { "title": "this" }},
  { "term": { "title": "test"   }}

can you provide a fully reproducible example including index/mapping creation and indexing of documents? This way it is easier to follow your problem.

Hi Reelsen,

Thanks for quick response. Below are curl call results:

curl http://localhost:9201/esIndex


Inserting records :

curl -X PUT "localhost:9201/esindex/estype/<id>" -H 'Content-Type: application/json' -d'
 "pub_date": 1520346474000,
    "@timestamp": "2018-03-06T14:27:54.666Z",
    "boost_value": 1,
    "search_suggetion": false,
    "@version": "1",
    "alias": "this is a test",
    "id": "<id>",
    "tag": "test",
    "type": "estype",
    "title": "this is a test",

/_cat/indices gievs below output:

green open esindex uuid 5 1 14 0 976.9kb 488.4kb

See this example

POST esindex/_analyze
  "analyzer" : "str_index_analyzer",
  "text" : "this is a test"

POST esindex/_analyze
  "analyzer" : "str_search_analyzer",
  "text" : "this test"

the output of the second analyze call just returns this test and this token is not emitted by the first call and thus never stored in the inverted index.

1 Like

Thanks a lot Reelsen.

Fixed it, and got better picture of ES.

1 Like

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