# Percolate existing document using query from another index

**URL:** <https://discuss.elastic.co/t/percolate-existing-document-using-query-from-another-index/17111>\
**Category:** Elasticsearch\
**Created:** [April 21, 2014, 12:16pm UTC](https://discuss.elastic.co/t/percolate-existing-document-using-query-from-another-index/17111 "2014-04-21T12:16:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Poomrat\_Boonyawong](https://avatars.discourse-cdn.com/v4/letter/p/8e7dd6/32.png) [@Poomrat\_Boonyawong](https://discuss.elastic.co/u/Poomrat_Boonyawong)\
**Post date:** [April 21, 2014, 12:16pm UTC](https://discuss.elastic.co/t/percolate-existing-document-using-query-from-another-index/17111/1 "2014-04-21T12:16:25Z")

</div>

Hi, I am trying to follow advice  
in [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-percolate.html#_dedicated_percolator_index)  
but percolating on existing document.  
This for some reason doesn't work for me in ES 1.1.0.

The same percolator works (match document) if it is in the same index as  
target document.

Here's my test document

> # curl -XGET
> 
> [http://pvcm-emsdata01.amers1b.ciscloud:9200/logstash-2014.04.18/apache\_access/HAtwipHtSnOmr8ZUn4Q4tw](http://pvcm-emsdata01.amers1b.ciscloud:9200/logstash-2014.04.18/apache_access/HAtwipHtSnOmr8ZUn4Q4tw)

{

> "\_index" : "logstash-2014.04.18",
> 
> "\_type" : "apache\_access",
> 
> "\_id" : "HAtwipHtSnOmr8ZUn4Q4tw",
> 
> "\_version" : 1,
> 
> "found" : true,
> 
> "\_source" : {
> 
> "@version" : "1",
> 
> "@timestamp" : "2014-04-18T08:50:48.461+00:00",
> 
> "type" : "apache\_access",
> 
> "tags" : ["input\_nxlog\_json", "logstash-ingestion-node-PVCM-EMSINGS01",
> 
> > "logstash-index-node-PVCM-EMSINDX01", "\_grokparsefailure"],
> 
> "host" : "pvcm-emshead01",
> 
> "message" : "10.42.78.81 - - [18/Apr/2014:08:50:47 +0000] GET
> 
> > /monitor/events/css/bootstrap-responsive.min.css HTTP/1.1 304 -",
> 
> "itic-lsg-code" : "HEAD",
> 
> ```
> ...
> 
> ```
> 
> }
> 
> }

If I add percolator like this

curl -XPUT

> [http://pvcm-emsdata01.amers1b.ciscloud:9200/logstash-2014.04.18/.percolator/head\_lsg\_in\_logstash\_index](http://pvcm-emsdata01.amers1b.ciscloud:9200/logstash-2014.04.18/.percolator/head_lsg_in_logstash_index)  
> -d '{ "query" : { "bool" : { "must" : [{ "match" : { "host" :  
> "pvcm-emshead01" } }, { "match" : { "itic-lsg-code" : "HEAD" } } ] } } }'

It match this document fine

> curl -XGET  
> [http://pvcm-emsdata01.amers1b.ciscloud:9200/logstash-2014.04.18/apache\_access/HAtwipHtSnOmr8ZUn4Q4tw/\_percolate](http://pvcm-emsdata01.amers1b.ciscloud:9200/logstash-2014.04.18/apache_access/HAtwipHtSnOmr8ZUn4Q4tw/_percolate)

{

"took" : 2,

"\_shards" : {

"total" : 2,

"successful" : 2,

"failed" : 0

},

"total" : 1,

"matches" : [{

"\_index" : "logstash-2014.04.18",

"\_id" : "head\_lsg\_in\_logstash\_index"

}

]

}

But if I add the same percolator to dedicated index

> curl -XPUT
> 
> > [http://pvcm-emsdata01.amers1b.ciscloud:9200/percolator/.percolator/head\_lsg](http://pvcm-emsdata01.amers1b.ciscloud:9200/percolator/.percolator/head_lsg)  
> > -d '{
> 
> "query" : {
> 
> "bool" : {
> 
> "must" : [{
> 
> "match" : {
> 
> "host" : "pvcm-emshead01"
> 
> }
> 
> }, {
> 
> "match" : {
> 
> "itic-lsg-code" : "HEAD"
> 
> }
> 
> }
> 
> ]
> 
> }
> 
> }
> 
> }'

I can't find any combination that use percolator in dedicated index against  
existing document. Here's combination I've tried to no avail

- Set percolate\_index and percolate\_type and call percolate against  
existing document - get match from percolator in document's index instead

curl -XGET

> > [http://pvcm-emsdata01.amers1b.ciscloud:9200/logstash-2014.04.18/apache\_access/HAtwipHtSnOmr8ZUn4Q4tw/\_percolate](http://pvcm-emsdata01.amers1b.ciscloud:9200/logstash-2014.04.18/apache_access/HAtwipHtSnOmr8ZUn4Q4tw/_percolate)  
> > -d'{
> 
> "percolate\_index" : "percolator",
> 
> "percolate\_type" : "apache\_access"
> 
> }'

{"took":2,"\_shards":{"total":2,"successful":2,"failed":0},"total":1,"matches":[{"\_index":"logstash-2014.04.18","\_id":"head\_lsg\_in\_logstash\_index"}]}

- Try calling percolate from dedicated index - error at run time

curl -XPOST

> > [http://pvcm-emsdata01.amers1b.ciscloud:9200/percolator/.percolator/\_percolate](http://pvcm-emsdata01.amers1b.ciscloud:9200/percolator/.percolator/_percolate)  
> > -d'{
> 
> ```
> "id": "HAtwipHtSnOmr8ZUn4Q4tw",
> 
> "percolate_index" : "logstash-2014.04.18",
> 
> "percolate_type" : "apache_access"
> 
> ```
> 
> }'

{"took":1,"\_shards":{"total":2,"successful":0,"failed":2,"failures":[{"index":"percolator","shard":0,"reason":"BroadcastShardOperationFailedException[[percolator][0]

> ]; nested: PercolateException[failed to percolate]; nested:  
> ElasticsearchIllegalArgumentException[Nothing to percolate];  
> "},{"index":"percolator","shard":1,"reason":"BroadcastShardOperationFailedException[[percolator][1]  
> ]; nested: PercolateException[failed to percolate]; nested:  
> ElasticsearchIllegalArgumentException[Nothing to percolate];  
> "}]},"total":0,"matches":}

Although if I try that percolator against new document (using "doc"), it  
matches just fine.

> curl -XGET
> 
> > [http://pvcm-emsdata01.amers1b.ciscloud:9200/percolator/apache\_access/\_percolate](http://pvcm-emsdata01.amers1b.ciscloud:9200/percolator/apache_access/_percolate)  
> > -d'{
> 
> ```
> "doc" : {
> 
> "type": "apache_access",
> 
> "tags": [
> 
> "input_nxlog_json",
> 
> "logstash-ingestion-node-PVCM-EMSINGS01",
> 
> "logstash-index-node-PVCM-EMSINDX01",
> 
> "_grokparsefailure"
> 
> ],
> 
> "host": "pvcm-emshead01",
> 
> "message": "10.42.78.81 - - [21/Apr/2014:09:25:47 +0000] GET 
> 
> ```
> 
> > /monitor/events/css/bootstrap.light.min.css HTTP/1.1 304 -",
> 
> ```
> "itic-lsg-code": "HEAD"
> 
> }
> 
> ```
> 
> }'

{"took":2,"\_shards":{"total":2,"successful":2,"failed":0},"total":2,"matches":[{"\_index":"percolator","\_id":"head\_lsg"},{"\_index":"percolator","\_id":"apache\_access\_get\_default"}]}

Can someone show me how this use case can be done or is it even supported?

Many thanks in advance

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/3eabdc40-9eb2-4f57-9f01-30c94fe9a3e7%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3eabdc40-9eb2-4f57-9f01-30c94fe9a3e7%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly\_2](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@Binh\_Ly\_2](https://discuss.elastic.co/u/Binh_Ly_2)\
**Post date:** [April 21, 2014, 10:06pm UTC](https://discuss.elastic.co/t/percolate-existing-document-using-query-from-another-index/17111/2 "2014-04-21T22:06:00Z")

</div>

If you have a doc in an index A and you want to percolate it against  
queries in index B, you'll need to specify the percolate\_index (and  
potentially percolate\_type) url param:

curl -XPOST  
"[http://localhost:9200/a/doc/1/\_percolate?pretty&percolate\_index=b](http://localhost:9200/a/doc/1/_percolate?pretty&percolate_index=b)"

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/5526868d-5b1f-46a2-b488-a22357f3ed10%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5526868d-5b1f-46a2-b488-a22357f3ed10%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Poomrat\_Boonyawong](https://avatars.discourse-cdn.com/v4/letter/p/8e7dd6/32.png) [@Poomrat\_Boonyawong](https://discuss.elastic.co/u/Poomrat_Boonyawong)\
**Post date:** [April 22, 2014, 3:58am UTC](https://discuss.elastic.co/t/percolate-existing-document-using-query-from-another-index/17111/3 "2014-04-22T03:58:34Z")

</div>

Now that is just what I need.  
Thanks a ton for this pointer.

On Tuesday, April 22, 2014 5:06:00 AM UTC+7, Binh Ly wrote:

> If you have a doc in an index A and you want to percolate it against  
> queries in index B, you'll need to specify the percolate\_index (and  
> potentially percolate\_type) url param:
> 
> curl -XPOST "  
> [http://localhost:9200/a/doc/1/\_percolate?pretty&percolate\_index=b](http://localhost:9200/a/doc/1/_percolate?pretty&percolate_index=b)"

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/663672a2-8bf0-4fe6-a73b-740004c3ccb3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/663672a2-8bf0-4fe6-a73b-740004c3ccb3%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:34am UTC](https://discuss.elastic.co/t/percolate-existing-document-using-query-from-another-index/17111/4 "2017-07-06T01:34:25Z")

</div>


