# Elasticsearch percolator for checking the existing doc

**URL:** <https://discuss.elastic.co/t/elasticsearch-percolator-for-checking-the-existing-doc/39227>\
**Category:** Elasticsearch\
**Created:** [January 14, 2016, 11:38am UTC](https://discuss.elastic.co/t/elasticsearch-percolator-for-checking-the-existing-doc/39227 "2016-01-14T11:38:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Navneet\_Mathpal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/navneet_mathpal/32/3677_2.png) [@Navneet\_Mathpal](https://discuss.elastic.co/u/Navneet_Mathpal)\
**Post date:** [January 14, 2016, 11:38am UTC](https://discuss.elastic.co/t/elasticsearch-percolator-for-checking-the-existing-doc/39227/1 "2016-01-14T11:38:39Z")

</div>

Hi,  
I have a requirement where I am getting documents and along with the doc I am getting a field date.  
Now I need to figure it out whether the doc is already there or not if It is already there I will add another field called last\_update for that doc (with the latest date I am getting ).

Is is possible using percolator (because for percolator I have to resister percolator query for each document so It would not be optimized solution )

Is there other optimal way possible ?

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [January 14, 2016, 11:45am UTC](https://discuss.elastic.co/t/elasticsearch-percolator-for-checking-the-existing-doc/39227/2 "2016-01-14T11:45:23Z")

</div>

Percolator probably isn't what you want - check out the update/upsert API: [https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html#upserts](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html#upserts)

---

<div class="post-metadata">

**Author:** ![Navneet\_Mathpal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/navneet_mathpal/32/3677_2.png) [@Navneet\_Mathpal](https://discuss.elastic.co/u/Navneet_Mathpal)\
**Post date:** [January 14, 2016, 12:31pm UTC](https://discuss.elastic.co/t/elasticsearch-percolator-for-checking-the-existing-doc/39227/3 "2016-01-14T12:31:27Z")

</div>

Thanks @Mark_Harwood,

This is exactly what I wanted . Currently I am sending my data through java bulk api.

> bulkProcessor.add(Requests.indexRequest(indexName).type(indexType).id(id).source(jsondoc));

Is it possible to use upate and upsert using bulk api ?

I want to reduce the CPU efforts by using bulk api .  
sending the lots of data using update & upsert could be overhead ?

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [January 14, 2016, 12:34pm UTC](https://discuss.elastic.co/t/elasticsearch-percolator-for-checking-the-existing-doc/39227/4 "2016-01-14T12:34:36Z")

</div>

Should work with bulk

---

<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:** [July 5, 2017, 11:24pm UTC](https://discuss.elastic.co/t/elasticsearch-percolator-for-checking-the-existing-doc/39227/5 "2017-07-05T23:24:31Z")

</div>

Closed on July 5, 2017, 11:24pm UTC


