# Regex and size for TermsFacet search

**URL:** <https://discuss.elastic.co/t/regex-and-size-for-termsfacet-search/4845>\
**Category:** Elasticsearch\
**Created:** [July 13, 2011, 5:35am UTC](https://discuss.elastic.co/t/regex-and-size-for-termsfacet-search/4845 "2011-07-13T05:35:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Weiwei\_Wang](https://avatars.discourse-cdn.com/v4/letter/w/b19c9b/32.png) [@Weiwei\_Wang](https://discuss.elastic.co/u/Weiwei_Wang)\
**Post date:** [July 13, 2011, 5:35am UTC](https://discuss.elastic.co/t/regex-and-size-for-termsfacet-search/4845/1 "2011-07-13T05:35:38Z")

</div>

Take the below query for example, the returned facet terms still  
contain characters which are not in regex [0-9], but if I set the  
facet size from 6000 to below 5000 the returned results will be as  
expected. I do not know what's the difference of the size parameter or  
it is a bug?

curl -XPOST "[http://localhost:9200/pimcontact/\_search](http://localhost:9200/pimcontact/_search)?  
pretty=true&pretty=true" -d '{  
"from" : 0,  
"size" : 0,  
"query" : {  
"match\_all" : {  
}  
},  
"filter" : {  
"bool" : {  
"must" : {  
"term" : {  
"account" : 118875  
}  
},  
"must" : {  
"term" : {  
"deleted" : 0  
}  
}  
}  
},  
"explain" : false,  
"fields" : [],  
"facets" : {  
"prefix" : {  
"terms" : {  
"field" : "prefix",  
"size" : 6000,  
"regex" : "[0-9]",  
"order" : "count"  
},  
"facet\_filter" : {  
"bool" : {  
"must" : {  
"term" : {  
"account" : 118875  
}  
},  
"must" : {  
"term" : {  
"deleted" : 0  
}  
}  
}  
}  
}  
}  
}'

---

<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, 4:00am UTC](https://discuss.elastic.co/t/regex-and-size-for-termsfacet-search/4845/2 "2017-07-06T04:00:53Z")

</div>

Closed on July 6, 2017, 4:00am UTC


