# Retrieving or saving matching document ID when using percolate

**URL:** <https://discuss.elastic.co/t/retrieving-or-saving-matching-document-id-when-using-percolate/351555>\
**Category:** Elasticsearch\
**Created:** [January 22, 2024, 3:19pm UTC](https://discuss.elastic.co/t/retrieving-or-saving-matching-document-id-when-using-percolate/351555 "2024-01-22T15:19:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Krikkits](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krikkits/32/125421_2.png) [@Krikkits](https://discuss.elastic.co/u/Krikkits)\
**Post date:** [January 22, 2024, 3:19pm UTC](https://discuss.elastic.co/t/retrieving-or-saving-matching-document-id-when-using-percolate/351555/1 "2024-01-22T15:19:57Z")

</div>

I am unfamiliar with percolate and honestly a bit confused. My idea is to use percolate on an existing index and not only getting how many match the query, but also which exact ones. The field "\_percolator\_document\_slot" seems to only show the index position of the matching document. Is it possible to modify this to show the exact ID of the matching documents? Or adding a new field to get the matching document ID some how?

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [January 23, 2024, 10:32am UTC](https://discuss.elastic.co/t/retrieving-or-saving-matching-document-id-when-using-percolate/351555/2 "2024-01-23T10:32:59Z")

</div>

Hi @Krikkits,

Welcome back! No worries at all, the percolate feature takes some time to get your head around. It's kind of like a reverse query in a way.

The general idea is that field of the `percolate` type in an index contains a query that you can use to find out if a stored query exists which matches that document. A common use case would be for alerts on ecommerce sites letting you know that an item is back in stock. So you would know the documents and want to find the query that matches that document, or [set of documents as covered here](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-percolate-query.html#_percolating_multiple_documents).

There is details in the [Elastic documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-percolate-query.html) about how it works, but I recommend taking a look at [this blog post](https://spinscale.de/posts/2021-09-15-understanding-elasticsearch-percolate-query.html) from a former Elastician which I think explains the topic very well.

Hopefully that helps! If not do let us know.

---

<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 20, 2024, 10:33am UTC](https://discuss.elastic.co/t/retrieving-or-saving-matching-document-id-when-using-percolate/351555/3 "2024-02-20T10:33:49Z")

</div>

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