# Percolate with bulk insert not working

**URL:** <https://discuss.elastic.co/t/percolate-with-bulk-insert-not-working/12426>\
**Category:** Elasticsearch\
**Created:** [June 15, 2013, 12:22am UTC](https://discuss.elastic.co/t/percolate-with-bulk-insert-not-working/12426 "2013-06-15T00:22:40Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinod\_eligeti](https://avatars.discourse-cdn.com/v4/letter/v/c4cdca/32.png) [@vinod\_eligeti](https://discuss.elastic.co/u/vinod_eligeti)\
**Post date:** [June 15, 2013, 12:22am UTC](https://discuss.elastic.co/t/percolate-with-bulk-insert-not-working/12426/1 "2013-06-15T00:22:40Z")

</div>

Hi guys,

I am trying to bulk insert and percolate at the same time however, I do not  
see the matches in the response. Here is the code i am dealing with:

TermQueryBuilder matchAll = QueryBuilders.termQuery("content", "hello");

client.prepareIndex("\_percolator", "my-index", "percolator\_1")  
.setSource(matchAll.buildAsBytes()).setType("my\_doc\_type")  
.setRefresh(true).execute().actionGet();

By above code i registered the percolator

Bulk insert:

BulkRequestBuilder bulkReq = client.prepareBulk();  
while(in.hasNext())  
{  
jsonBuilder = buildContent(in.next()); // builds the my\_doc\_type

bulkReq.add(client.prepareIndex("my-index",  
"my\_doc\_type").setSource(jsonBuilder).setPercolate("\*"));  
}

BulkResponse response = bulkReq.execute().actionGet();

for(BulkItemResponse item : response.responses)  
{  
if(!item.failed())  
{  
matches = ((IndexResponse) item.response()).matches();

System.out.println(matches); // print the matches  
}  
}

the above print statements are not printing "percolator\_1" even though i am  
seeding my\_doc\_type with field content = "hello".

Appreciate your help if you can tell me where I am doing wrong here?

thanks

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![vinod\_eligeti](https://avatars.discourse-cdn.com/v4/letter/v/c4cdca/32.png) [@vinod\_eligeti](https://discuss.elastic.co/u/vinod_eligeti)\
**Post date:** [June 17, 2013, 5:27pm UTC](https://discuss.elastic.co/t/percolate-with-bulk-insert-not-working/12426/2 "2013-06-17T17:27:47Z")

</div>

Any idea guys?

On Friday, June 14, 2013 5:22:40 PM UTC-7, vinod eligeti wrote:

> Hi guys,
> 
> I am trying to bulk insert and percolate at the same time however, I do  
> not see the matches in the response. Here is the code i am dealing with:
> 
> TermQueryBuilder matchAll = QueryBuilders.termQuery("content", "hello");
> 
> client.prepareIndex("\_percolator", "my-index", "percolator\_1")  
> .setSource(matchAll.buildAsBytes()).setType("my\_doc\_type")  
> .setRefresh(true).execute().actionGet();
> 
> By above code i registered the percolator
> 
> Bulk insert:
> 
> BulkRequestBuilder bulkReq = client.prepareBulk();  
> while(in.hasNext())  
> {  
> jsonBuilder = buildContent(in.next()); // builds the my\_doc\_type
> 
> bulkReq.add(client.prepareIndex("my-index",  
> "my\_doc\_type").setSource(jsonBuilder).setPercolate("\*"));  
> }
> 
> BulkResponse response = bulkReq.execute().actionGet();
> 
> for(BulkItemResponse item : response.responses)  
> {  
> if(!item.failed())  
> {  
> matches = ((IndexResponse) item.response()).matches();
> 
> System.out.println(matches); // print the matches  
> }  
> }
> 
> the above print statements are not printing "percolator\_1" even though i  
> am seeding my\_doc\_type with field content = "hello".
> 
> Appreciate your help if you can tell me where I am doing wrong here?
> 
> thanks

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![vinod\_eligeti](https://avatars.discourse-cdn.com/v4/letter/v/c4cdca/32.png) [@vinod\_eligeti](https://discuss.elastic.co/u/vinod_eligeti)\
**Post date:** [June 17, 2013, 6:21pm UTC](https://discuss.elastic.co/t/percolate-with-bulk-insert-not-working/12426/3 "2013-06-17T18:21:54Z")

</div>

More insight on this:

When I ran the percolate code:

=======================  
TermQueryBuilder matchAll = QueryBuilders.termQuery("content", "hello");

# client.prepareIndex("\_percolator", "my-index", "percolator\_1") .setSource(matchAll.buildAsBytes()).setType("my\_doc\_type") .setRefresh(true).execute().actionGet();

I see the following exception:

org.elasticsearch.ElasticSearchIllegalArgumentException: query must be  
provided for percolate request  
at  
org.elasticsearch.common.Preconditions.checkArgument(Preconditions.java:95)  
at  
org.elasticsearch.index.percolator.PercolatorExecutor.addQuery(PercolatorExecutor.java:229)  
at  
org.elasticsearch.index.percolator.PercolatorExecutor.addQuery(PercolatorExecutor.java:191)  
at  
org.elasticsearch.index.percolator.PercolatorService$RealTimePercolatorOperationListener.postIndexUnderLock(PercolatorService.java:294)  
at  
org.elasticsearch.index.indexing.ShardIndexingService.postIndexUnderLock(ShardIndexingService.java:158)  
at  
org.elasticsearch.index.engine.robin.RobinEngine.innerIndex(RobinEngine.java:589)  
at  
org.elasticsearch.index.engine.robin.RobinEngine.index(RobinEngine.java:488)  
at  
org.elasticsearch.index.shard.service.InternalIndexShard.index(InternalIndexShard.java:330)  
at  
org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:207)  
at  
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:532)  
at  
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:430)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
at java.lang.Thread.run(Thread.java:680)

Why am I seeing this exception?

On Friday, June 14, 2013 5:22:40 PM UTC-7, vinod eligeti wrote:

> Hi guys,
> 
> I am trying to bulk insert and percolate at the same time however, I do  
> not see the matches in the response. Here is the code i am dealing with:
> 
> TermQueryBuilder matchAll = QueryBuilders.termQuery("content", "hello");
> 
> client.prepareIndex("\_percolator", "my-index", "percolator\_1")  
> .setSource(matchAll.buildAsBytes()).setType("my\_doc\_type")  
> .setRefresh(true).execute().actionGet();
> 
> By above code i registered the percolator
> 
> Bulk insert:
> 
> BulkRequestBuilder bulkReq = client.prepareBulk();  
> while(in.hasNext())  
> {  
> jsonBuilder = buildContent(in.next()); // builds the my\_doc\_type
> 
> bulkReq.add(client.prepareIndex("my-index",  
> "my\_doc\_type").setSource(jsonBuilder).setPercolate("\*"));  
> }
> 
> BulkResponse response = bulkReq.execute().actionGet();
> 
> for(BulkItemResponse item : response.responses)  
> {  
> if(!item.failed())  
> {  
> matches = ((IndexResponse) item.response()).matches();
> 
> System.out.println(matches); // print the matches  
> }  
> }
> 
> the above print statements are not printing "percolator\_1" even though i  
> am seeding my\_doc\_type with field content = "hello".
> 
> Appreciate your help if you can tell me where I am doing wrong here?
> 
> thanks

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [June 17, 2013, 6:28pm UTC](https://discuss.elastic.co/t/percolate-with-bulk-insert-not-working/12426/4 "2013-06-17T18:28:57Z")

</div>

My guess is that your matchAll will output something like:  
"term" : {  
"field1" : "value1"  
}  
And not  
{  
"query" : {  
"term" : {  
"field1" : "value1"  
}  
}  
}  
I'm wondering if example in [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/percolate/) is ok.  
Tests show that the common usage is:  
client().prepareIndex("\_percolator", "test", "kuku")  
.setSource(jsonBuilder().startObject()  
.field("color", "blue")  
.field("query", termQuery("field1", "value1"))  
.endObject())  
.setRefresh(true)  
.execute().actionGet();

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 17 juin 2013 à 20:21, vinod eligeti [veligeti999@gmail.com](mailto:veligeti999@gmail.com) a écrit :

> More insight on this:
> 
> When I ran the percolate code:
> 
> =======================  
> TermQueryBuilder matchAll = QueryBuilders.termQuery("content", "hello");
> 
> # client.prepareIndex("\_percolator", "my-index", "percolator\_1") .setSource(matchAll.buildAsBytes()).setType("my\_doc\_type") .setRefresh(true).execute().actionGet();
> 
> I see the following exception:
> 
> org.elasticsearch.ElasticSearchIllegalArgumentException: query must be provided for percolate request  
> at org.elasticsearch.common.Preconditions.checkArgument(Preconditions.java:95)  
> at org.elasticsearch.index.percolator.PercolatorExecutor.addQuery(PercolatorExecutor.java:229)  
> at org.elasticsearch.index.percolator.PercolatorExecutor.addQuery(PercolatorExecutor.java:191)  
> at org.elasticsearch.index.percolator.PercolatorService$RealTimePercolatorOperationListener.postIndexUnderLock(PercolatorService.java:294)  
> at org.elasticsearch.index.indexing.ShardIndexingService.postIndexUnderLock(ShardIndexingService.java:158)  
> at org.elasticsearch.index.engine.robin.RobinEngine.innerIndex(RobinEngine.java:589)  
> at org.elasticsearch.index.engine.robin.RobinEngine.index(RobinEngine.java:488)  
> at org.elasticsearch.index.shard.service.InternalIndexShard.index(InternalIndexShard.java:330)  
> at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:207)  
> at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:532)  
> at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:430)  
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> at java.lang.Thread.run(Thread.java:680)
> 
> Why am I seeing this exception?
> 
> On Friday, June 14, 2013 5:22:40 PM UTC-7, vinod eligeti wrote:  
> Hi guys,
> 
> I am trying to bulk insert and percolate at the same time however, I do not see the matches in the response. Here is the code i am dealing with:
> 
> TermQueryBuilder matchAll = QueryBuilders.termQuery("content", "hello");
> 
> client.prepareIndex("\_percolator", "my-index", "percolator\_1")  
> .setSource(matchAll.buildAsBytes()).setType("my\_doc\_type")  
> .setRefresh(true).execute().actionGet();
> 
> By above code i registered the percolator
> 
> Bulk insert:
> 
> BulkRequestBuilder bulkReq = client.prepareBulk();  
> while(in.hasNext())  
> {  
> jsonBuilder = buildContent(in.next()); // builds the my\_doc\_type
> 
> bulkReq.add(client.prepareIndex("my-index", "my\_doc\_type").setSource(jsonBuilder).setPercolate("\*"));  
> }
> 
> BulkResponse response = bulkReq.execute().actionGet();
> 
> for(BulkItemResponse item : response.responses)  
> {  
> if(!item.failed())  
> {  
> matches = ((IndexResponse) item.response()).matches();
> 
> ```
> System.out.println(matches); // print the matches
> 
> ```
> 
> }  
> }
> 
> the above print statements are not printing "percolator\_1" even though i am seeding my\_doc\_type with field content = "hello".
> 
> Appreciate your help if you can tell me where I am doing wrong here?
> 
> thanks
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![vinod\_eligeti](https://avatars.discourse-cdn.com/v4/letter/v/c4cdca/32.png) [@vinod\_eligeti](https://discuss.elastic.co/u/vinod_eligeti)\
**Post date:** [June 17, 2013, 6:36pm UTC](https://discuss.elastic.co/t/percolate-with-bulk-insert-not-working/12426/5 "2013-06-17T18:36:50Z")

</div>

You are right David. When I printed the bytes as string it should the first  
form. How do I get into the second form?

I followed exactly what is specified in the documentation at:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

Is it because I misunderstood the documentation or something is missing in  
the docs?

thanks

On Monday, June 17, 2013 11:28:57 AM UTC-7, David Pilato wrote:

> My guess is that your matchAll will output something like:
> 
> "term" : {  
> "field1" : "value1"  
> }
> 
> And not
> 
> {  
> "query" : {  
> "term" : {  
> "field1" : "value1"  
> }  
> }  
> }
> 
> I'm wondering if example in  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/percolate/) is ok.  
> Tests show that the common usage is:  
> client().prepareIndex("\_percolator", "test", "kuku")  
> .setSource(jsonBuilder().startObject()  
> .field("color", "blue")  
> .field("query", termQuery("field1", "value1"))  
> .endObject())  
> .setRefresh(true)  
> .execute().actionGet();
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)  
> | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> 
> Le 17 juin 2013 à 20:21, vinod eligeti \<[velig...@gmail.com](mailto:velig...@gmail.com) \<javascript:\>\>  
> a écrit :
> 
> More insight on this:
> 
> When I ran the percolate code:
> 
> =======================  
> TermQueryBuilder matchAll = QueryBuilders.termQuery("content", "hello");
> 
> # client.prepareIndex("\_percolator", "my-index", "percolator\_1") .setSource(matchAll.buildAsBytes()).setType("my\_doc\_type") .setRefresh(true).execute().actionGet();
> 
> I see the following exception:
> 
> org.elasticsearch.ElasticSearchIllegalArgumentException: query must be  
> provided for percolate request  
> at  
> org.elasticsearch.common.Preconditions.checkArgument(Preconditions.java:95)  
> at  
> org.elasticsearch.index.percolator.PercolatorExecutor.addQuery(PercolatorExecutor.java:229)  
> at  
> org.elasticsearch.index.percolator.PercolatorExecutor.addQuery(PercolatorExecutor.java:191)  
> at  
> org.elasticsearch.index.percolator.PercolatorService$RealTimePercolatorOperationListener.postIndexUnderLock(PercolatorService.java:294)  
> at  
> org.elasticsearch.index.indexing.ShardIndexingService.postIndexUnderLock(ShardIndexingService.java:158)  
> at  
> org.elasticsearch.index.engine.robin.RobinEngine.innerIndex(RobinEngine.java:589)  
> at  
> org.elasticsearch.index.engine.robin.RobinEngine.index(RobinEngine.java:488)  
> at  
> org.elasticsearch.index.shard.service.InternalIndexShard.index(InternalIndexShard.java:330)  
> at  
> org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:207)  
> at  
> org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:532)  
> at  
> org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:430)  
> at  
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
> at  
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> at java.lang.Thread.run(Thread.java:680)
> 
> Why am I seeing this exception?
> 
> On Friday, June 14, 2013 5:22:40 PM UTC-7, vinod eligeti wrote:
> 
> > Hi guys,
> > 
> > I am trying to bulk insert and percolate at the same time however, I do  
> > not see the matches in the response. Here is the code i am dealing with:
> > 
> > TermQueryBuilder matchAll = QueryBuilders.termQuery("content", "hello");
> > 
> > client.prepareIndex("\_percolator", "my-index", "percolator\_1")  
> > .setSource(matchAll.buildAsBytes()).setType("my\_doc\_type")  
> > .setRefresh(true).execute().actionGet();
> > 
> > By above code i registered the percolator
> > 
> > Bulk insert:
> > 
> > BulkRequestBuilder bulkReq = client.prepareBulk();  
> > while(in.hasNext())  
> > {  
> > jsonBuilder = buildContent(in.next()); // builds the my\_doc\_type
> > 
> > bulkReq.add(client.prepareIndex("my-index",  
> > "my\_doc\_type").setSource(jsonBuilder).setPercolate("\*"));  
> > }
> > 
> > BulkResponse response = bulkReq.execute().actionGet();
> > 
> > for(BulkItemResponse item : response.responses)  
> > {  
> > if(!item.failed())  
> > {  
> > matches = ((IndexResponse) item.response()).matches();
> > 
> > System.out.println(matches); // print the matches  
> > }  
> > }
> > 
> > the above print statements are not printing "percolator\_1" even though i  
> > am seeding my\_doc\_type with field content = "hello".
> > 
> > Appreciate your help if you can tell me where I am doing wrong here?
> > 
> > thanks
> 
> --  
> 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [June 17, 2013, 6:37pm UTC](https://discuss.elastic.co/t/percolate-with-bulk-insert-not-working/12426/6 "2013-06-17T18:37:36Z")

</div>

I think it's an issue in doc. Opened issue here: [https://github.com/elasticsearch/elasticsearch.github.com/issues/449](https://github.com/elasticsearch/elasticsearch.github.com/issues/449)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 17 juin 2013 à 20:36, vinod eligeti [veligeti999@gmail.com](mailto:veligeti999@gmail.com) a écrit :

> You are right David. When I printed the bytes as string it should the first form. How do I get into the second form?
> 
> I followed exactly what is specified in the documentation at:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/percolate/)
> 
> Is it because I misunderstood the documentation or something is missing in the docs?
> 
> thanks
> 
> On Monday, June 17, 2013 11:28:57 AM UTC-7, David Pilato wrote:  
> My guess is that your matchAll will output something like:  
> "term" : {  
> "field1" : "value1"  
> }  
> And not  
> {  
> "query" : {  
> "term" : {  
> "field1" : "value1"  
> }  
> }  
> }  
> I'm wondering if example in [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/percolate/) is ok.  
> Tests show that the common usage is:  
> client().prepareIndex("\_percolator", "test", "kuku")  
> .setSource(jsonBuilder().startObject()  
> .field("color", "blue")  
> .field("query", termQuery("field1", "value1"))  
> .endObject())  
> .setRefresh(true)  
> .execute().actionGet();
> 
> --  
> David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
> @dadoonet | @elasticsearchfr | @scrutmydocs
> 
> Le 17 juin 2013 à 20:21, vinod eligeti [velig...@gmail.com](mailto:velig...@gmail.com) a écrit :
> 
> > More insight on this:
> > 
> > When I ran the percolate code:
> > 
> > =======================  
> > TermQueryBuilder matchAll = QueryBuilders.termQuery("content", "hello");
> > 
> > # client.prepareIndex("\_percolator", "my-index", "percolator\_1") .setSource(matchAll.buildAsBytes()).setType("my\_doc\_type") .setRefresh(true).execute().actionGet();
> > 
> > I see the following exception:
> > 
> > org.elasticsearch.ElasticSearchIllegalArgumentException: query must be provided for percolate request  
> > at org.elasticsearch.common.Preconditions.checkArgument(Preconditions.java:95)  
> > at org.elasticsearch.index.percolator.PercolatorExecutor.addQuery(PercolatorExecutor.java:229)  
> > at org.elasticsearch.index.percolator.PercolatorExecutor.addQuery(PercolatorExecutor.java:191)  
> > at org.elasticsearch.index.percolator.PercolatorService$RealTimePercolatorOperationListener.postIndexUnderLock(PercolatorService.java:294)  
> > at org.elasticsearch.index.indexing.ShardIndexingService.postIndexUnderLock(ShardIndexingService.java:158)  
> > at org.elasticsearch.index.engine.robin.RobinEngine.innerIndex(RobinEngine.java:589)  
> > at org.elasticsearch.index.engine.robin.RobinEngine.index(RobinEngine.java:488)  
> > at org.elasticsearch.index.shard.service.InternalIndexShard.index(InternalIndexShard.java:330)  
> > at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:207)  
> > at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:532)  
> > at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:430)  
> > at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
> > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> > at java.lang.Thread.run(Thread.java:680)
> > 
> > Why am I seeing this exception?
> > 
> > On Friday, June 14, 2013 5:22:40 PM UTC-7, vinod eligeti wrote:  
> > Hi guys,
> > 
> > I am trying to bulk insert and percolate at the same time however, I do not see the matches in the response. Here is the code i am dealing with:
> > 
> > TermQueryBuilder matchAll = QueryBuilders.termQuery("content", "hello");
> > 
> > client.prepareIndex("\_percolator", "my-index", "percolator\_1")  
> > .setSource(matchAll.buildAsBytes()).setType("my\_doc\_type")  
> > .setRefresh(true).execute().actionGet();
> > 
> > By above code i registered the percolator
> > 
> > Bulk insert:
> > 
> > BulkRequestBuilder bulkReq = client.prepareBulk();  
> > while(in.hasNext())  
> > {  
> > jsonBuilder = buildContent(in.next()); // builds the my\_doc\_type
> > 
> > bulkReq.add(client.prepareIndex("my-index", "my\_doc\_type").setSource(jsonBuilder).setPercolate("\*"));  
> > }
> > 
> > BulkResponse response = bulkReq.execute().actionGet();
> > 
> > for(BulkItemResponse item : response.responses)  
> > {  
> > if(!item.failed())  
> > {  
> > matches = ((IndexResponse) item.response()).matches();
> > 
> > ```
> > System.out.println(matches); // print the matches
> > 
> > ```
> > 
> > }  
> > }
> > 
> > the above print statements are not printing "percolator\_1" even though i am seeding my\_doc\_type with field content = "hello".
> > 
> > Appreciate your help if you can tell me where I am doing wrong here?
> > 
> > thanks
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![vinod\_eligeti](https://avatars.discourse-cdn.com/v4/letter/v/c4cdca/32.png) [@vinod\_eligeti](https://discuss.elastic.co/u/vinod_eligeti)\
**Post date:** [June 17, 2013, 6:53pm UTC](https://discuss.elastic.co/t/percolate-with-bulk-insert-not-working/12426/7 "2013-06-17T18:53:49Z")

</div>

Thanks that works.

Also a minor suggestion since I was not looking at the server logs I didnt  
get any idea as why my request is failing. BulKRequest has nice API where I  
know whether there is a failure or not, similarly it would be nice to have  
in these APIs whether the request is correct or not.

thanks

On Monday, June 17, 2013 11:37:36 AM UTC-7, David Pilato wrote:

> I think it's an issue in doc. Opened issue here:  
> [https://github.com/elasticsearch/elasticsearch.github.com/issues/449](https://github.com/elasticsearch/elasticsearch.github.com/issues/449)
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)  
> | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> 
> Le 17 juin 2013 à 20:36, vinod eligeti \<[velig...@gmail.com](mailto:velig...@gmail.com) \<javascript:\>\>  
> a écrit :
> 
> You are right David. When I printed the bytes as string it should the  
> first form. How do I get into the second form?
> 
> I followed exactly what is specified in the documentation at:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/percolate/)
> 
> Is it because I misunderstood the documentation or something is missing in  
> the docs?
> 
> thanks
> 
> On Monday, June 17, 2013 11:28:57 AM UTC-7, David Pilato wrote:
> 
> > My guess is that your matchAll will output something like:
> > 
> > "term" : {  
> > "field1" : "value1"  
> > }
> > 
> > And not
> > 
> > {  
> > "query" : {  
> > "term" : {  
> > "field1" : "value1"  
> > }  
> > }  
> > }
> > 
> > I'm wondering if example in  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/percolate/) is ok.  
> > Tests show that the common usage is:  
> > client().prepareIndex("\_percolator", "test", "kuku")  
> > .setSource(jsonBuilder().startObject()  
> > .field("color", "blue")  
> > .field("query", termQuery("field1", "value1"))  
> > .endObject())  
> > .setRefresh(true)  
> > .execute().actionGet();
> > 
> > --  
> > _David Pilato_ | _Technical Advocate_ | \*[Elasticsearch.com](http://Elasticsearch.com)[http://elasticsearch.com/](http://elasticsearch.com/)  
> > \*  
> > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)  
> > | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> > 
> > Le 17 juin 2013 à 20:21, vinod eligeti [velig...@gmail.com](mailto:velig...@gmail.com) a écrit :
> > 
> > More insight on this:
> > 
> > When I ran the percolate code:
> > 
> > =======================  
> > TermQueryBuilder matchAll = QueryBuilders.termQuery("content", "hello");
> > 
> > # client.prepareIndex("\_percolator", "my-index", "percolator\_1") .setSource(matchAll.buildAsBytes()).setType("my\_doc\_type") .setRefresh(true).execute().actionGet();
> > 
> > I see the following exception:
> > 
> > org.elasticsearch.ElasticSearchIllegalArgumentException: query must be  
> > provided for percolate request  
> > at  
> > org.elasticsearch.common.Preconditions.checkArgument(Preconditions.java:95)  
> > at  
> > org.elasticsearch.index.percolator.PercolatorExecutor.addQuery(PercolatorExecutor.java:229)  
> > at  
> > org.elasticsearch.index.percolator.PercolatorExecutor.addQuery(PercolatorExecutor.java:191)  
> > at  
> > org.elasticsearch.index.percolator.PercolatorService$RealTimePercolatorOperationListener.postIndexUnderLock(PercolatorService.java:294)  
> > at  
> > org.elasticsearch.index.indexing.ShardIndexingService.postIndexUnderLock(ShardIndexingService.java:158)  
> > at  
> > org.elasticsearch.index.engine.robin.RobinEngine.innerIndex(RobinEngine.java:589)  
> > at  
> > org.elasticsearch.index.engine.robin.RobinEngine.index(RobinEngine.java:488)  
> > at  
> > org.elasticsearch.index.shard.service.InternalIndexShard.index(InternalIndexShard.java:330)  
> > at  
> > org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:207)  
> > at  
> > org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:532)  
> > at  
> > org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:430)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> > at java.lang.Thread.run(Thread.java:680)
> > 
> > Why am I seeing this exception?
> > 
> > On Friday, June 14, 2013 5:22:40 PM UTC-7, vinod eligeti wrote:
> > 
> > > Hi guys,
> > > 
> > > I am trying to bulk insert and percolate at the same time however, I do  
> > > not see the matches in the response. Here is the code i am dealing with:
> > > 
> > > TermQueryBuilder matchAll = QueryBuilders.termQuery("content", "hello");
> > > 
> > > client.prepareIndex("\_percolator", "my-index", "percolator\_1")  
> > > .setSource(matchAll.buildAsBytes()).setType("my\_doc\_type")  
> > > .setRefresh(true).execute().actionGet();
> > > 
> > > By above code i registered the percolator
> > > 
> > > Bulk insert:
> > > 
> > > BulkRequestBuilder bulkReq = client.prepareBulk();  
> > > while(in.hasNext())  
> > > {  
> > > jsonBuilder = buildContent(in.next()); // builds the my\_doc\_type
> > > 
> > > bulkReq.add(client.prepareIndex("my-index",  
> > > "my\_doc\_type").setSource(jsonBuilder).setPercolate("\*"));  
> > > }
> > > 
> > > BulkResponse response = bulkReq.execute().actionGet();
> > > 
> > > for(BulkItemResponse item : response.responses)  
> > > {  
> > > if(!item.failed())  
> > > {  
> > > matches = ((IndexResponse) item.response()).matches();
> > > 
> > > System.out.println(matches); // print the matches  
> > > }  
> > > }
> > > 
> > > the above print statements are not printing "percolator\_1" even though i  
> > > am seeding my\_doc\_type with field content = "hello".
> > > 
> > > Appreciate your help if you can tell me where I am doing wrong here?
> > > 
> > > thanks
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [June 18, 2013, 7:11am UTC](https://discuss.elastic.co/t/percolate-with-bulk-insert-not-working/12426/8 "2013-06-18T07:11:57Z")

</div>

I don't get this last part.  
Did you mean that on Client side, you did not get any error or exception back?

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 17 juin 2013 à 20:53, vinod eligeti [veligeti999@gmail.com](mailto:veligeti999@gmail.com) a écrit :

> Thanks that works.
> 
> Also a minor suggestion since I was not looking at the server logs I didnt get any idea as why my request is failing. BulKRequest has nice API where I know whether there is a failure or not, similarly it would be nice to have in these APIs whether the request is correct or not.
> 
> thanks
> 
> On Monday, June 17, 2013 11:37:36 AM UTC-7, David Pilato wrote:  
> I think it's an issue in doc. Opened issue here: [https://github.com/elasticsearch/elasticsearch.github.com/issues/449](https://github.com/elasticsearch/elasticsearch.github.com/issues/449)
> 
> --  
> David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
> @dadoonet | @elasticsearchfr | @scrutmydocs
> 
> Le 17 juin 2013 à 20:36, vinod eligeti [velig...@gmail.com](mailto:velig...@gmail.com) a écrit :
> 
> > You are right David. When I printed the bytes as string it should the first form. How do I get into the second form?
> > 
> > I followed exactly what is specified in the documentation at:  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/percolate/)
> > 
> > Is it because I misunderstood the documentation or something is missing in the docs?
> > 
> > thanks
> > 
> > On Monday, June 17, 2013 11:28:57 AM UTC-7, David Pilato wrote:  
> > My guess is that your matchAll will output something like:  
> > "term" : {  
> > "field1" : "value1"  
> > }  
> > And not  
> > {  
> > "query" : {  
> > "term" : {  
> > "field1" : "value1"  
> > }  
> > }  
> > }  
> > I'm wondering if example in [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/percolate/) is ok.  
> > Tests show that the common usage is:  
> > client().prepareIndex("\_percolator", "test", "kuku")  
> > .setSource(jsonBuilder().startObject()  
> > .field("color", "blue")  
> > .field("query", termQuery("field1", "value1"))  
> > .endObject())  
> > .setRefresh(true)  
> > .execute().actionGet();
> > 
> > --  
> > David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
> > @dadoonet | @elasticsearchfr | @scrutmydocs
> > 
> > Le 17 juin 2013 à 20:21, vinod eligeti [velig...@gmail.com](mailto:velig...@gmail.com) a écrit :
> > 
> > > More insight on this:
> > > 
> > > When I ran the percolate code:
> > > 
> > > =======================  
> > > TermQueryBuilder matchAll = QueryBuilders.termQuery("content", "hello");
> > > 
> > > # client.prepareIndex("\_percolator", "my-index", "percolator\_1") .setSource(matchAll.buildAsBytes()).setType("my\_doc\_type") .setRefresh(true).execute().actionGet();
> > > 
> > > I see the following exception:
> > > 
> > > org.elasticsearch.ElasticSearchIllegalArgumentException: query must be provided for percolate request  
> > > at org.elasticsearch.common.Preconditions.checkArgument(Preconditions.java:95)  
> > > at org.elasticsearch.index.percolator.PercolatorExecutor.addQuery(PercolatorExecutor.java:229)  
> > > at org.elasticsearch.index.percolator.PercolatorExecutor.addQuery(PercolatorExecutor.java:191)  
> > > at org.elasticsearch.index.percolator.PercolatorService$RealTimePercolatorOperationListener.postIndexUnderLock(PercolatorService.java:294)  
> > > at org.elasticsearch.index.indexing.ShardIndexingService.postIndexUnderLock(ShardIndexingService.java:158)  
> > > at org.elasticsearch.index.engine.robin.RobinEngine.innerIndex(RobinEngine.java:589)  
> > > at org.elasticsearch.index.engine.robin.RobinEngine.index(RobinEngine.java:488)  
> > > at org.elasticsearch.index.shard.service.InternalIndexShard.index(InternalIndexShard.java:330)  
> > > at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:207)  
> > > at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:532)  
> > > at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:430)  
> > > at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
> > > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> > > at java.lang.Thread.run(Thread.java:680)
> > > 
> > > Why am I seeing this exception?
> > > 
> > > On Friday, June 14, 2013 5:22:40 PM UTC-7, vinod eligeti wrote:  
> > > Hi guys,
> > > 
> > > I am trying to bulk insert and percolate at the same time however, I do not see the matches in the response. Here is the code i am dealing with:
> > > 
> > > TermQueryBuilder matchAll = QueryBuilders.termQuery("content", "hello");
> > > 
> > > client.prepareIndex("\_percolator", "my-index", "percolator\_1")  
> > > .setSource(matchAll.buildAsBytes()).setType("my\_doc\_type")  
> > > .setRefresh(true).execute().actionGet();
> > > 
> > > By above code i registered the percolator
> > > 
> > > Bulk insert:
> > > 
> > > BulkRequestBuilder bulkReq = client.prepareBulk();  
> > > while(in.hasNext())  
> > > {  
> > > jsonBuilder = buildContent(in.next()); // builds the my\_doc\_type
> > > 
> > > bulkReq.add(client.prepareIndex("my-index", "my\_doc\_type").setSource(jsonBuilder).setPercolate("\*"));  
> > > }
> > > 
> > > BulkResponse response = bulkReq.execute().actionGet();
> > > 
> > > for(BulkItemResponse item : response.responses)  
> > > {  
> > > if(!item.failed())  
> > > {  
> > > matches = ((IndexResponse) item.response()).matches();
> > > 
> > > ```
> > > System.out.println(matches); // print the matches
> > > 
> > > ```
> > > 
> > > }  
> > > }
> > > 
> > > the above print statements are not printing "percolator\_1" even though i am seeding my\_doc\_type with field content = "hello".
> > > 
> > > Appreciate your help if you can tell me where I am doing wrong here?
> > > 
> > > thanks
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![vinod\_eligeti](https://avatars.discourse-cdn.com/v4/letter/v/c4cdca/32.png) [@vinod\_eligeti](https://discuss.elastic.co/u/vinod_eligeti)\
**Post date:** [June 18, 2013, 7:48am UTC](https://discuss.elastic.co/t/percolate-with-bulk-insert-not-working/12426/9 "2013-06-18T07:48:52Z")

</div>

Sorry for the confusion, Yes i do not get any exception back at the client  
side when I specified the invalid query.

On Tue, Jun 18, 2013 at 12:11 AM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> I don't get this last part.  
> Did you mean that on Client side, you did not get any error or exception  
> back?
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)  
> | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> 
> Le 17 juin 2013 à 20:53, vinod eligeti [veligeti999@gmail.com](mailto:veligeti999@gmail.com) a écrit :
> 
> Thanks that works.
> 
> Also a minor suggestion since I was not looking at the server logs I didnt  
> get any idea as why my request is failing. BulKRequest has nice API where I  
> know whether there is a failure or not, similarly it would be nice to have  
> in these APIs whether the request is correct or not.
> 
> thanks
> 
> On Monday, June 17, 2013 11:37:36 AM UTC-7, David Pilato wrote:
> 
> > I think it's an issue in doc. Opened issue here: [https://github.com/](https://github.com/)\*\*  
> > elasticsearch/elasticsearch.\*\*[github.com/issues/449](http://github.com/issues/449)[https://github.com/elasticsearch/elasticsearch.github.com/issues/449](https://github.com/elasticsearch/elasticsearch.github.com/issues/449)
> > 
> > --  
> > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)[http://elasticsearch.com/](http://elasticsearch.com/)  
> > \*  
> > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)  
> > |_\* @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> > 
> > Le 17 juin 2013 à 20:36, vinod eligeti [velig...@gmail.com](mailto:velig...@gmail.com) a écrit :
> > 
> > You are right David. When I printed the bytes as string it should the  
> > first form. How do I get into the second form?
> > 
> > I followed exactly what is specified in the documentation at:  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/ **guide/reference/java-api/** percolate/)[http://www.elasticsearch.org/guide/reference/java-api/percolate/](http://www.elasticsearch.org/guide/reference/java-api/percolate/)
> > 
> > Is it because I misunderstood the documentation or something is missing  
> > in the docs?
> > 
> > thanks
> > 
> > On Monday, June 17, 2013 11:28:57 AM UTC-7, David Pilato wrote:
> > 
> > > My guess is that your matchAll will output something like:
> > > 
> > > "term" : {  
> > > "field1" : "value1"  
> > > }
> > > 
> > > And not
> > > 
> > > {  
> > > "query" : {  
> > > "term" : {  
> > > "field1" : "value1"  
> > > }  
> > > }  
> > > }
> > > 
> > > I'm wondering if example in [http://www.elasticsearch](http://www.elasticsearch).\*\*  
> > > org/guide/reference/java-api/\*\*percolate/[http://www.elasticsearch.org/guide/reference/java-api/percolate/](http://www.elasticsearch.org/guide/reference/java-api/percolate/) is  
> > > ok.  
> > > Tests show that the common usage is:  
> > > client().prepareIndex("\_\*\*percolator", "test", "kuku")  
> > > .setSource(jsonBuilder().\*\*startObject()  
> > > .field("color", "blue")  
> > > .field("query", termQuery("field1", "value1"))  
> > > .endObject())  
> > > .setRefresh(true)  
> > > .execute().actionGet();
> > > 
> > > --  
> > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)[http://elasticsearch.com/](http://elasticsearch.com/)  
> > > \*  
> > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)  
> > > |_\* @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> > > 
> > > Le 17 juin 2013 à 20:21, vinod eligeti [velig...@gmail.com](mailto:velig...@gmail.com) a écrit :
> > > 
> > > More insight on this:
> > > 
> > > When I ran the percolate code:
> > > 
> > > =======================  
> > > TermQueryBuilder matchAll = QueryBuilders.termQuery("\*\*content",  
> > > "hello");
> > > 
> > > # client.prepareIndex("_\*\*percolator", "my-index", "percolator\_1") .setSource(matchAll.\*\*buildAsBytes()).setType("my_\*\*doc\_type") .setRefresh(true).execute().\*\*actionGet();
> > > 
> > > I see the following exception:
> > > 
> > > org.elasticsearch. **ElasticSearchIllegalArgumentEx** ception: query must  
> > > be provided for percolate request  
> > > at org.elasticsearch.common.**Preconditions.checkArgument(**  
> > > Preconditions.java:95)  
> > > at org.elasticsearch.index. **percolator.PercolatorExecutor.**  
> > > addQuery(PercolatorExecutor.**java:229)  
> > > at org.elasticsearch.index.percolator.PercolatorExecutor.  
> > > addQuery(PercolatorExecutor.java:191)  
> > > at org.elasticsearch.index.percolator.PercolatorService$  
> > > RealTimePercolatorOperationListener.postIndexUnderLock(**  
> > > PercolatorService.java:294)  
> > > at org.elasticsearch.index. **indexing.ShardIndexingService.**  
> > > postIndexUnderLock(\*\*ShardIndexingService.java:158)  
> > > at org.elasticsearch.index. **engine.robin.RobinEngine.**  
> > > innerIndex(RobinEngine.java:\*_589)  
> > > at org.elasticsearch.index. **engine.robin.RobinEngine.**  
> > > index(RobinEngine.java:488)  
> > > at org.elasticsearch.index.shard. **service.InternalIndexShard.**  
> > > index(InternalIndexShard.java:330)  
> > > at org.elasticsearch.action. **index.TransportIndexAction.**  
> > > shardOperationOnPrimary(**TransportIndexAction.java:207)  
> > > at org.elasticsearch.action.support.replication.  
> > > TransportShardReplicationOpera**tionAction$AsyncShardOperationAction.  
> > > \*performOnPrimary( **TransportShardReplicationOpera** tionAction.java:532)  
> > > at org.elasticsearch.action. **support.replication.**  
> > > TransportShardReplicationOperationAction$_  
> > > AsyncShardOperationAction$1.\*\*run( **TransportShardReplicationOpera**  
> > > tionAction.java:430)  
> > > at java.util.concurrent. **ThreadPoolExecutor$Worker.**  
> > > runTask(ThreadPoolExecutor.\*\*java:886)  
> > > at java.util.concurrent.**ThreadPoolExecutor$Worker.run(**  
> > > ThreadPoolExecutor.java:908)  
> > > at java.lang.Thread.run(Thread.\*\*java:680)
> > > 
> > > Why am I seeing this exception?
> > > 
> > > On Friday, June 14, 2013 5:22:40 PM UTC-7, vinod eligeti wrote:
> > > 
> > > > Hi guys,
> > > > 
> > > > I am trying to bulk insert and percolate at the same time however, I do  
> > > > not see the matches in the response. Here is the code i am dealing with:
> > > > 
> > > > TermQueryBuilder matchAll = QueryBuilders.termQuery("\*\*content",  
> > > > "hello");
> > > > 
> > > > client.prepareIndex("_\*\*percolator", "my-index", "percolator\_1")  
> > > > .setSource(matchAll.\*\*buildAsBytes()).setType("my_\*\*doc\_type")  
> > > > .setRefresh(true).execute().\*\*actionGet();
> > > > 
> > > > By above code i registered the percolator
> > > > 
> > > > Bulk insert:
> > > > 
> > > > BulkRequestBuilder bulkReq = client.prepareBulk();  
> > > > while(in.hasNext())  
> > > > {  
> > > > jsonBuilder = buildContent(in.next()); // builds the my\_doc\_type
> > > > 
> > > > bulkReq.add(client.\*\*prepareIndex("my-index", "my\_doc\_type").setSource(  
> > > > **jsonBuilder).setPercolate("\*")**);  
> > > > }
> > > > 
> > > > BulkResponse response = bulkReq.execute().actionGet();
> > > > 
> > > > for(BulkItemResponse item : response.responses)  
> > > > {  
> > > > if(!item.failed())  
> > > > {  
> > > > matches = ((IndexResponse) item.response()).matches();
> > > > 
> > > > System.out.println(matches); // print the matches  
> > > > }  
> > > > }
> > > > 
> > > > the above print statements are not printing "percolator\_1" even though  
> > > > i am seeding my\_doc\_type with field content = "hello".
> > > > 
> > > > Appreciate your help if you can tell me where I am doing wrong here?
> > > > 
> > > > thanks
> > > 
> > > --  
> > > 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 elasticsearc...@googlegroups.\*\*com.  
> > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > .
> > 
> > --  
> > 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 elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).  
> > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > .
> 
> --  
> 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).
> 
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:30am UTC](https://discuss.elastic.co/t/percolate-with-bulk-insert-not-working/12426/10 "2017-07-06T02:30:40Z")

</div>


