# Bulk-add percolator queries

**URL:** <https://discuss.elastic.co/t/bulk-add-percolator-queries/2159>\
**Category:** Elasticsearch\
**Created:** [June 8, 2015, 8:15pm UTC](https://discuss.elastic.co/t/bulk-add-percolator-queries/2159 "2015-06-08T20:15:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![EricLandry](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ericlandry/32/15977_2.png) [@EricLandry](https://discuss.elastic.co/u/EricLandry)\
**Post date:** [June 8, 2015, 8:15pm UTC](https://discuss.elastic.co/t/bulk-add-percolator-queries/2159/1 "2015-06-08T20:15:41Z")

</div>

I want to throw my many documents to a LOT of percolator queries (my query count is in the 6-digit). I've found how to multi-percolate many documents at once, but haven't found how to bulk-add many queries at once.

Any ideas?

---

<div class="post-metadata">

**Author:** ![EricLandry](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ericlandry/32/15977_2.png) [@EricLandry](https://discuss.elastic.co/u/EricLandry)\
**Post date:** [June 10, 2015, 3:21pm UTC](https://discuss.elastic.co/t/bulk-add-percolator-queries/2159/2 "2015-06-10T15:21:03Z")

</div>

According to the [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-percolate.html), I can register a query in the percolator using:

```
curl -XPUT 'localhost:9200/my-index/.percolator/1' -d '{
    "query" : {
        "match" : {
            "message" : "bonsai tree"
        }
    }
}'

```

Can I add many of these in one fell swoop?

---

<div class="post-metadata">

**Author:** ![EricLandry](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ericlandry/32/15977_2.png) [@EricLandry](https://discuss.elastic.co/u/EricLandry)\
**Post date:** [June 15, 2015, 2:54pm UTC](https://discuss.elastic.co/t/bulk-add-percolator-queries/2159/3 "2015-06-15T14:54:35Z")

</div>

I've set a bounty on SO, if that can motivate anybody 👍

> <https://stackoverflow.com/questions/30717126/is-there-a-way-to-bulk-add-elasticsearch-percolations>

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [June 15, 2015, 3:52pm UTC](https://discuss.elastic.co/t/bulk-add-percolator-queries/2159/4 "2015-06-15T15:52:38Z")

</div>

Why not use the \_bulk API ([https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html)) and set the index as `my-index` the type as `.percolator` and the body as the query?

I haven't actually tried this out but I imagine it should work given that you can register percolator queries using the standard index API

HTH

---

<div class="post-metadata">

**Author:** ![EricLandry](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ericlandry/32/15977_2.png) [@EricLandry](https://discuss.elastic.co/u/EricLandry)\
**Post date:** [June 15, 2015, 5:10pm UTC](https://discuss.elastic.co/t/bulk-add-percolator-queries/2159/5 "2015-06-15T17:10:39Z")

</div>

That worked! Thanks!!!

---

<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 6, 2017, 12:07am UTC](https://discuss.elastic.co/t/bulk-add-percolator-queries/2159/6 "2017-07-06T00:07:23Z")

</div>


