# Use index to judge data,but not found

**URL:** https://discuss.elastic.co/t/use-index-to-judge-data-but-not-found/350446
**Category:** Elasticsearch
**Created:** [January 5, 2024, 10:24am UTC](https://discuss.elastic.co/t/use-index-to-judge-data-but-not-found/350446 "2024-01-05T10:24:55Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![yunke\_yin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yunke_yin/32/122469_2.png) [@yunke\_yin](https://discuss.elastic.co/u/yunke_yin)
#### Post date: [January 5, 2024, 10:24am UTC](https://discuss.elastic.co/t/use-index-to-judge-data-but-not-found/350446/1 "2024-01-05T10:24:55Z")

</div>

please help me.  
I got many data of the same type. In some cases, the known data must exist, but I need to further confirm which index the data is under. I chose to judge in the following way, but cannot found then throw exception.  
This happens occasionally . elasticsearch version : 6.8.23，3 nodes  
**example:**

```auto
( indexs is this type of elasticsearch indexs )
for (String index:indexs){
                exists = client.prepareGet(index, model, id)
                        .setFetchSource(false)
                        .execute()
                        .actionGet().isExists();
                if(exists){
                    return index;
                }
            }

        throw new RuntimeException("cannot fount index");

```

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [January 5, 2024, 10:26am UTC](https://discuss.elastic.co/t/use-index-to-judge-data-but-not-found/350446/2 "2024-01-05T10:26:34Z")

</div>

> [@yunke\_yin](#):
>
> This happens occasionally . elasticsearch version : 6.8.23

This is a very old version, which has been EOL a long time. I would recommend you upgrade to a supported version.

What is the size, topology and configuration of your cluster?

---

<div class="post-metadata">

### Author: ![yunke\_yin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yunke_yin/32/122469_2.png) [@yunke\_yin](https://discuss.elastic.co/u/yunke_yin)
#### Post date: [January 5, 2024, 10:27am UTC](https://discuss.elastic.co/t/use-index-to-judge-data-but-not-found/350446/3 "2024-01-05T10:27:35Z")

</div>

3 nodes

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [January 5, 2024, 10:49am UTC](https://discuss.elastic.co/t/use-index-to-judge-data-but-not-found/350446/4 "2024-01-05T10:49:34Z")

</div>

How are they configured? If all your 3 nodes are master eligible, have you set `discovery.zen.minimum_master_nodes` in your config to `2` in order to avoid split brain scenarios?

---

<div class="post-metadata">

### Author: ![yunke\_yin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yunke_yin/32/122469_2.png) [@yunke\_yin](https://discuss.elastic.co/u/yunke_yin)
#### Post date: [January 8, 2024, 1:45am UTC](https://discuss.elastic.co/t/use-index-to-judge-data-but-not-found/350446/5 "2024-01-08T01:45:23Z")

</div>

yes, i do, and i checked the es log at that time and there was nothing abnormal.

---

<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: [February 5, 2024, 1:46am UTC](https://discuss.elastic.co/t/use-index-to-judge-data-but-not-found/350446/6 "2024-02-05T01:46:19Z")

</div>

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