ES [Get by document ID] vs [Search by terms] returns different results

Hi,

From my understanding, there is no difference between the get by document id and search by terms but the performance.
However, I just encountered a very strange issue.
when I use: GET /my_index/_doc/1 --> it returns:

{
  "_index": "my_index",
  "_type": "_doc",
  "_id": "1",
  "found": false
}

but when I use:

GET /my_index/_search
{
  "query": {
    "term": {
      "_id": 1
    }
  }
}

It does returns the result....

  {
    "_index": "my_index",
    "_type": "_doc",
    "_id": "1",
    "_score": 1.0,
    "_source": {
        "name": "xxx"
     }
}

Both uses the same _id field to match, but the first cannot find, the second get the results
Can anyone help to take a look?

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