# Percolate Query using \_size matches no documents

**URL:** https://discuss.elastic.co/t/percolate-query-using--size-matches-no-documents/15179
**Category:** Elasticsearch
**Created:** [January 9, 2014, 5:33pm UTC](https://discuss.elastic.co/t/percolate-query-using--size-matches-no-documents/15179 "2014-01-09T17:33:46Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![tinman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tinman/32/133391_2.png) [@tinman](https://discuss.elastic.co/u/tinman)
#### Post date: [January 9, 2014, 5:33pm UTC](https://discuss.elastic.co/t/percolate-query-using--size-matches-no-documents/15179/1 "2014-01-09T17:33:46Z")

</div>

Is filtering on the \_size field allowed on percolate requests?

Adding into a percolate query in either a filter or the query section a \_size range matches no documents.

Walking through reproducing the problem:

Register the query:

curl -XPUT '[http://localhost:9200/\_percolator/test\_index/queryNamedSue](http://localhost:9200/_percolator/test_index/queryNamedSue)' -d '{  
"query" : {  
"constant\_score": {  
"filter": {  
"and": [ {  
"query" : {  
"query\_string" : {  
"query" : "batman",  
"default\_field" : "all"  
}  
}  
}, {  
"bool" : {  
"must" : [ {  
"term" : { "ni.language" : "en" }  
}, {  
"range" : {  
"\_size" : {  
"from" : 0,  
"to" : 10000,  
"include\_lower" : true,  
"include\_upper" : true  
}  
}  
} ]  
}  
} ]  
}  
}  
}  
}'

Then percolate a document (aside: 'ni.content' field in our mapping is a default search field):

curl -XGET '[http://localhost:9200/test\_index/testType/\_percolate](http://localhost:9200/test_index/testType/_percolate)' -d '{  
"doc": {  
"ni": {  
"content": "So Batman walks into a bar",  
"language": "en"  
}  
}  
}'

Which results in

{"ok":true,"matches":["queryNamedSue"]}

Now if the query is changed to include a \_size range,

curl -XPUT '[http://localhost:9200/\_percolator/test\_index/queryNamedSue](http://localhost:9200/_percolator/test_index/queryNamedSue)' -d '{  
"query" : {  
"constant\_score": {  
"filter": {  
"and": [ {  
"query" : {  
"query\_string" : {  
"query" : "batman",  
"default\_field" : "all"  
}  
}  
}, {  
"bool" : {  
"must" : [ {  
"term" : { "ni.language" : "en" }  
}, {  
"range" : {  
"\_size" : {  
"from" : 0,  
"to" : 10000,  
"include\_lower" : true,  
"include\_upper" : true  
}  
}  
} ]  
}  
} ]  
}  
}  
}  
}'

Percolating the same document yields

{"ok":true,"matches":[]}

I have researched and found that percolating with a mapping that enables and stores \_size was failing over a year ago, but this issue was patched: [https://github.com/elasticsearch/elasticsearch/pull/2353](https://github.com/elasticsearch/elasticsearch/pull/2353).

We set a default template that for all types in the mapping enables \_size and sets it to store. Our percolator node uses the following configuration:

Index Settings:

index.number\_of\_shards: variesBasedOnWorkload  
index.number\_of\_replicas: 0  
index.auto\_expand\_replicas: "false"  
index.dynamic: "true"  
index.mapper.dynamic: "true"  
index.store.compress.stored: "true"  
index.store.compress.tv: "true"  
index.term\_index\_divisor: "4"  
index.merge.scheduler.max\_thread\_count: 1

Node Settings:

cache.memory.direct: "false"  
http.enabled: "false"  
gateway.type: "none"  
index.store.type: "memory"

---

<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:57am UTC](https://discuss.elastic.co/t/percolate-query-using--size-matches-no-documents/15179/2 "2017-07-06T01:57:38Z")

</div>


