# Filtered query returning zero results when edgeNGram filter is applied to index analyzer

**URL:** <https://discuss.elastic.co/t/filtered-query-returning-zero-results-when-edgengram-filter-is-applied-to-index-analyzer/8712>\
**Category:** Elasticsearch\
**Created:** [August 10, 2012, 10:22pm UTC](https://discuss.elastic.co/t/filtered-query-returning-zero-results-when-edgengram-filter-is-applied-to-index-analyzer/8712 "2012-08-10T22:22:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jamesh/32/2771_2.png) [@jamesh](https://discuss.elastic.co/u/jamesh)\
**Post date:** [August 10, 2012, 10:22pm UTC](https://discuss.elastic.co/t/filtered-query-returning-zero-results-when-edgengram-filter-is-applied-to-index-analyzer/8712/1 "2012-08-10T22:22:43Z")

</div>

Hello,

I have a filtered query that returns results as expected until I enable  
edgeNGram on the index analyzer.  
After the edgeNGram filter is added and data re-indexed, the hits total is  
zero. If I modify the query by removing everything in the "filter" node, I  
start to see results again.

I'm running ElasticSearch version 0.19.8 on Ubuntu 10.10.

Do I need to construct my filtered query differently to make it play nice  
with edgeNGram?  
Any help would be greatly appreciated.

Here is the analyzer I am using:  
analysis: {  
analyzer: {  
default\_index: {  
type: 'custom',  
tokenizer: 'standard',  
filter: [  
'stop',  
'asciifolding',  
'snowball',  
'lowercase',  
'custom\_edge\_ngram'  
]  
},  
default\_search: {  
type: 'custom',  
tokenizer: 'standard',  
filter: [  
'asciifolding',  
'snowball',  
'lowercase'  
]  
}  
},  
filter: {  
custom\_edge\_ngram: {  
type: 'edgeNGram',  
side: 'front',  
min\_gram: 1,  
max\_gram: 10  
}  
}  
}

And the query:  
{  
"query":{  
"filtered":{  
"query":{  
"query\_string":{  
"query":"foo"  
}  
},  
"filter":{  
"and":[  
{  
"or":[  
{  
"terms":{  
"groupIds":[  
"gid00001",  
"gid00002"  
]  
}  
},  
{  
"term":{  
"userId":"uid00001"  
}  
}  
]  
}  
]  
}  
}  
},  
"size":10,  
"from":0  
}

Thank you,  
James

--

---

<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, 3:16am UTC](https://discuss.elastic.co/t/filtered-query-returning-zero-results-when-edgengram-filter-is-applied-to-index-analyzer/8712/2 "2017-07-06T03:16:46Z")

</div>


