# Percolation and filtering queries

**URL:** <https://discuss.elastic.co/t/percolation-and-filtering-queries/11088>\
**Category:** Elasticsearch\
**Created:** [March 10, 2013, 3:45pm UTC](https://discuss.elastic.co/t/percolation-and-filtering-queries/11088 "2013-03-10T15:45:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Itamar\_Syn\_Hershko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/itamar_syn_hershko/32/725_2.png) [@Itamar\_Syn\_Hershko](https://discuss.elastic.co/u/Itamar_Syn_Hershko)\
**Post date:** [March 10, 2013, 3:45pm UTC](https://discuss.elastic.co/t/percolation-and-filtering-queries/11088/1 "2013-03-10T15:45:01Z")

</div>

Hi,

Is the behavior described here  
[http://www.elasticsearch.org/guide/reference/api/percolate.html](http://www.elasticsearch.org/guide/reference/api/percolate.html) under  
"Filtering Executed Queries" tested anywhere?

If I add the following code to PercolatorExecutorTests.testSimplePercolator  
it fails with an NPE in PercolatorExecutor.java:504 - indicesService is  
null.

```
    percolatorExecutor.addQuery("test2", XContentFactory.smileBuilder()
            .startObject()
            .field("color", "blue")
            .field("query", termQuery("field1", 1))
            .endObject().bytes());

    BytesReference sourceWithQuery =

```

XContentFactory.jsonBuilder().startObject()  
.field("query", termQuery("color", "blue"))  
.startObject("doc")  
.field("field1", 1)  
.field("field2", "value")  
.endObject().endObject()  
.bytes();

```
    percolate = percolatorExecutor.percolate(new

```

PercolatorExecutor.SourceRequest("type1", sourceWithQuery));  
assertThat(percolate.matches(), hasSize(2));  
assertThat(percolate.matches(), hasItems("test1", "test2"));

Itamar.

--  
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:47am UTC](https://discuss.elastic.co/t/percolation-and-filtering-queries/11088/2 "2017-07-06T02:47:21Z")

</div>


