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

**URL:** <https://discuss.elastic.co/t/es-get-by-document-id-vs-search-by-terms-returns-different-results/300700>\
**Category:** Elasticsearch\
**Created:** [March 25, 2022, 1:26pm UTC](https://discuss.elastic.co/t/es-get-by-document-id-vs-search-by-terms-returns-different-results/300700 "2022-03-25T13:26:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![T-Muller-25](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/t-muller-25/32/103530_2.png) [@T-Muller-25](https://discuss.elastic.co/u/T-Muller-25)\
**Post date:** [March 25, 2022, 1:26pm UTC](https://discuss.elastic.co/t/es-get-by-document-id-vs-search-by-terms-returns-different-results/300700/1 "2022-03-25T13:26:50Z")

</div>

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:

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

```

but when I use:

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

```

It does returns the result....

```auto
  {
    "_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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 22, 2022, 1:26pm UTC](https://discuss.elastic.co/t/es-get-by-document-id-vs-search-by-terms-returns-different-results/300700/2 "2022-04-22T13:26:53Z")

</div>

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