# Multiple index issue when querying same document

**URL:** <https://discuss.elastic.co/t/multiple-index-issue-when-querying-same-document/182577>\
**Category:** Elasticsearch\
**Created:** [May 24, 2019, 7:40am UTC](https://discuss.elastic.co/t/multiple-index-issue-when-querying-same-document/182577 "2019-05-24T07:40:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![isarib](https://avatars.discourse-cdn.com/v4/letter/i/b9e5f3/32.png) [@isarib](https://discuss.elastic.co/u/isarib)\
**Post date:** [May 24, 2019, 7:40am UTC](https://discuss.elastic.co/t/multiple-index-issue-when-querying-same-document/182577/1 "2019-05-24T07:40:41Z")

</div>

Is there a way I can ensure the results from multiple indexes are mapped/displayed correctly?

What seems to happen at the moment with the below results, in separate indexes, is the later does not overwrite the document - therefor will display 2 document results as opposed to 1.

What should happen is the document should get overwritten with the later, since we are using the same document id - just different indexes.

IF we changed the test scenario, and write to the same index eg jobs-2019-june, the document would get overwritten and displayed correctly with the later "success" results.

Example:

Index: jobs-2019-may  
document\_id: 1234987  
Fields:  
name: Job1234  
status: started  
status\_achieved@timestamp: YYYY-MM-DD-HH:MM:SS

\*\*\* New Month \*\*\*

Index: jobs-2019-june  
document\_id: 1234987  
Fields:  
name: Job1234  
status: success  
status\_achieved@timestamp: YYYY-MM-DD-HH:MM:SS

Kibana Index Pattern: jobs-\*

---

<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:** [May 24, 2019, 7:57am UTC](https://discuss.elastic.co/t/multiple-index-issue-when-querying-same-document/182577/2 "2019-05-24T07:57:28Z")

</div>

I don't think you can do that automatically.  
If you want to overwrite an existing document, you need to send the `PUT` request to the index where this document actually lives.

---

<div class="post-metadata">

**Author:** ![isarib](https://avatars.discourse-cdn.com/v4/letter/i/b9e5f3/32.png) [@isarib](https://discuss.elastic.co/u/isarib)\
**Post date:** [May 27, 2019, 7:53am UTC](https://discuss.elastic.co/t/multiple-index-issue-when-querying-same-document/182577/3 "2019-05-27T07:53:45Z")

</div>

Thanks for your reply.

It may very mean storing individual indexes does not work for me then, and to go single index.

---

<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:** [June 24, 2019, 7:53am UTC](https://discuss.elastic.co/t/multiple-index-issue-when-querying-same-document/182577/4 "2019-06-24T07:53:45Z")

</div>

Closed on June 24, 2019, 7:53am UTC

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