# The id query will trigger refresh, but I still can't search with query qsl?

**URL:** <https://discuss.elastic.co/t/the-id-query-will-trigger-refresh-but-i-still-cant-search-with-query-qsl/195829>\
**Category:** Elasticsearch\
**Created:** [August 20, 2019, 1:28am UTC](https://discuss.elastic.co/t/the-id-query-will-trigger-refresh-but-i-still-cant-search-with-query-qsl/195829 "2019-08-20T01:28:03Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![lance](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@lance](https://discuss.elastic.co/u/lance)\
**Post date:** [August 20, 2019, 1:28am UTC](https://discuss.elastic.co/t/the-id-query-will-trigger-refresh-but-i-still-cant-search-with-query-qsl/195829/1 "2019-08-20T01:28:04Z")

</div>

official documentation : the get API will issue a refresh call in-place to make the document visible.  
[id query doc](https://www.elastic.co/guide/en/elasticsearch/reference/6.3/docs-get.html)

First I call the id query, then call query QSL, the official documentation says it will call refresh, but I still can't search with query qsl?

(I set the refresh\_interval is 60s for test)

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [August 20, 2019, 2:59am UTC](https://discuss.elastic.co/t/the-id-query-will-trigger-refresh-but-i-still-cant-search-with-query-qsl/195829/2 "2019-08-20T02:59:29Z")

</div>

It will only call a refresh if the document has been updated.

---

<div class="post-metadata">

**Author:** ![lance](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@lance](https://discuss.elastic.co/u/lance)\
**Post date:** [August 20, 2019, 6:30am UTC](https://discuss.elastic.co/t/the-id-query-will-trigger-refresh-but-i-still-cant-search-with-query-qsl/195829/3 "2019-08-20T06:30:28Z")

</div>

![1566282068(1)](https://us1.discourse-cdn.com/elastic/original/3X/a/4/a49ea3554ee105d333084fc74369bedfc98186b0.png) ![1566282083(1)](https://us1.discourse-cdn.com/elastic/original/3X/3/2/3278454cbec27c27473e3c8ff382186222145bd8.png)

As shown in the figure,I first add a document, and then call the id query to find this data, but I still can't query with the query QSL, so querying a new document will not refresh?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 20, 2019, 6:35am UTC](https://discuss.elastic.co/t/the-id-query-will-trigger-refresh-but-i-still-cant-search-with-query-qsl/195829/4 "2019-08-20T06:35:09Z")

</div>

Is this field a keyword or not analyzed?

---

<div class="post-metadata">

**Author:** ![lance](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@lance](https://discuss.elastic.co/u/lance)\
**Post date:** [August 20, 2019, 6:38am UTC](https://discuss.elastic.co/t/the-id-query-will-trigger-refresh-but-i-still-cant-search-with-query-qsl/195829/5 "2019-08-20T06:38:02Z")

</div>

![1566282765(1)](https://us1.discourse-cdn.com/elastic/original/3X/6/6/66e9a285a50bf66dec6bba5fff25843e834cd9ae.png)  
 ![1566282448(1)](https://us1.discourse-cdn.com/elastic/original/3X/c/8/c8bf22eb04cdd9c59903fe5c7a2b788842d29ba5.png)

Wǒ chángshì qù gēngxīn yītiáo wéndàng, gēngxīn level cóng DEBUG8 biàn chéng DEBUG9, ránhòu shǐyòng id cháxún kěyǐ zhǎodào zhǎodào zhè tiáo wéndàng, dànshì wǒ shǐyòng query DSL yòng DEBUG9 qù cháxún zhe réngrán zhǎo bù dào zhè tiáo wéndàng.

87/5000

I tried to update a document, update the level from DEBUG8 to DEBUG9, and then use the id query to find this document, but I still can't find this document using the query DSL.  
So does the id query not trigger refresh?

---

<div class="post-metadata">

**Author:** ![lance](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@lance](https://discuss.elastic.co/u/lance)\
**Post date:** [August 20, 2019, 6:40am UTC](https://discuss.elastic.co/t/the-id-query-will-trigger-refresh-but-i-still-cant-search-with-query-qsl/195829/6 "2019-08-20T06:40:33Z")

</div>

Yes, this field is a keyword type

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 20, 2019, 6:52am UTC](https://discuss.elastic.co/t/the-id-query-will-trigger-refresh-but-i-still-cant-search-with-query-qsl/195829/7 "2019-08-20T06:52:41Z")

</div>

I'll try to reproduce later today.

The workaround is to call the refresh API.

---

<div class="post-metadata">

**Author:** ![lance](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@lance](https://discuss.elastic.co/u/lance)\
**Post date:** [August 20, 2019, 7:21am UTC](https://discuss.elastic.co/t/the-id-query-will-trigger-refresh-but-i-still-cant-search-with-query-qsl/195829/9 "2019-08-20T07:21:09Z")

</div>

Thanks for your reply. I set the refresh\_interval is 60s for test.  
I have a guess whether the id query is query the translog to get real-time data?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 20, 2019, 8:28am UTC](https://discuss.elastic.co/t/the-id-query-will-trigger-refresh-but-i-still-cant-search-with-query-qsl/195829/10 "2019-08-20T08:28:31Z")

</div>

So I was able to reproduce it with:

```auto
DELETE test
PUT test 
{
  "settings": {
    "refresh_interval": "-1"
  }
}
PUT test/_doc/1
{
  "foo": "bar"
}
GET test/_search
GET test/_doc/1
GET test/_search
POST test/_refresh
GET test/_search

```

I opened a documentation issue at:

> <https://github.com/elastic/elasticsearch/issues/45717>

Thanks for reporting.

---

<div class="post-metadata">

**Author:** ![lance](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@lance](https://discuss.elastic.co/u/lance)\
**Post date:** [August 20, 2019, 8:40am UTC](https://discuss.elastic.co/t/the-id-query-will-trigger-refresh-but-i-still-cant-search-with-query-qsl/195829/12 "2019-08-20T08:40:31Z")

</div>

If the id query real-time is not implemented by refresh, then it is implemented by what?  
Whether to obtain real-time data by querying translog?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 20, 2019, 8:51am UTC](https://discuss.elastic.co/t/the-id-query-will-trigger-refresh-but-i-still-cant-search-with-query-qsl/195829/13 "2019-08-20T08:51:21Z")

</div>

If the refresh did not happen, yes it's read from the translog.

---

<div class="post-metadata">

**Author:** ![lance](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@lance](https://discuss.elastic.co/u/lance)\
**Post date:** [August 20, 2019, 8:56am UTC](https://discuss.elastic.co/t/the-id-query-will-trigger-refresh-but-i-still-cant-search-with-query-qsl/195829/14 "2019-08-20T08:56:35Z")

</div>

Thank you very much for your answer. 😄

---

<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:** [September 17, 2019, 8:56am UTC](https://discuss.elastic.co/t/the-id-query-will-trigger-refresh-but-i-still-cant-search-with-query-qsl/195829/15 "2019-09-17T08:56:55Z")

</div>

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