# Cross-cluster search not returning all hits from IDs query, sometimes

**URL:** https://discuss.elastic.co/t/cross-cluster-search-not-returning-all-hits-from-ids-query-sometimes/192323
**Category:** Elasticsearch
**Created:** [July 25, 2019, 9:08pm UTC](https://discuss.elastic.co/t/cross-cluster-search-not-returning-all-hits-from-ids-query-sometimes/192323 "2019-07-25T21:08:39Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![loren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/loren/32/44942_2.png) [@loren](https://discuss.elastic.co/u/loren)
#### Post date: [July 25, 2019, 9:08pm UTC](https://discuss.elastic.co/t/cross-cluster-search-not-returning-all-hits-from-ids-query-sometimes/192323/1 "2019-07-25T21:08:39Z")

</div>

Why do my cross-cluster IDs queries sometimes return all but 1 or 2 of the results?

I have a 7.2.0 cluster executing an IDs query across 3 remote clusters usually with 500-1000 IDs in each query. I set the size parameter to be the length of my ID array. I usually get back all of the IDs but sometimes I get back all but 1 or 2 of them. Repeating the query again gets me 100% of the results.

If I just hit the clusters directly instead of going through CCS, I get back 100% of the results all the time with size=len(my\_ids).

Thinking it might be a fencepost error, I tried len(my\_ids)+1 but no luck. I also tried setting `ccs_minimize_roundtrips=False` just as a wild guess.

Strange as that all is, I seem to have found a hacky workaround: if I double the size param (i.e., size=2\*len(my\_ids)), _I get back 100% of the results all the time_.

Can anyone suggest what might be happening there?

Possibly related to [IDs query returning incomplete results](https://discuss.elastic.co/t/ids-query-returning-incomplete-results/127934).

---

<div class="post-metadata">

### Author: ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)
#### Post date: [August 2, 2019, 9:20am UTC](https://discuss.elastic.co/t/cross-cluster-search-not-returning-all-hits-from-ids-query-sometimes/192323/2 "2019-08-02T09:20:24Z")

</div>

Hi Loren,  
could you post more details on how to reproduce this please? Some sample data, your query etc.?

Thanks  
Luca

---

<div class="post-metadata">

### Author: ![loren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/loren/32/44942_2.png) [@loren](https://discuss.elastic.co/u/loren)
#### Post date: [August 2, 2019, 6:02pm UTC](https://discuss.elastic.co/t/cross-cluster-search-not-returning-all-hits-from-ids-query-sometimes/192323/3 "2019-08-02T18:02:13Z")

</div>

Thank you for responding Luca.

The query was very simple:

```auto
GET cluster1:my_index,cluster2:my_index,cluster3:my_index/_search
{
  "size": 5678, 
  "_source": "pa*", 
  "query": {
    "ids": {
      "values": [
        "id1",
        "id2",
        "id3",
        "id4",
       ....
       "id5678"
      ]
    }
  }
}

```

I wish I could replicate it for you. The 3 indices on the remote clusters are all multi-TB, and the error only happens 5-10% of the time for a group of IDs, and then never again for that group.

As I ended up needing to bring back more than 10000 results, I changed the search query to a scan/scroll. I have not observed the problem there.

I'm sorry I can't be more helpful in tracking this down. Perhaps someone else will run across this issue, too, and add their finding to this post.

---

<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: [August 30, 2019, 6:02pm UTC](https://discuss.elastic.co/t/cross-cluster-search-not-returning-all-hits-from-ids-query-sometimes/192323/4 "2019-08-30T18:02:14Z")

</div>

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