# Narrowing down search space for fuzzy searches

**URL:** <https://discuss.elastic.co/t/narrowing-down-search-space-for-fuzzy-searches/6760>\
**Category:** Elasticsearch\
**Created:** [February 20, 2012, 8:15pm UTC](https://discuss.elastic.co/t/narrowing-down-search-space-for-fuzzy-searches/6760 "2012-02-20T20:15:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Niklas\_Therning](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niklas_therning/32/2847_2.png) [@Niklas\_Therning](https://discuss.elastic.co/u/Niklas_Therning)\
**Post date:** [February 20, 2012, 8:15pm UTC](https://discuss.elastic.co/t/narrowing-down-search-space-for-fuzzy-searches/6760/1 "2012-02-20T20:15:27Z")

</div>

Hi,

I have an index with about 10 million documents. I'd like to run a fuzzy  
search on those but that just takes too much time (10-20 s). Thankfully  
I'm able to narrow down the search space to a few hundred documents  
first using a query which takes less than a second. How I can run my  
fuzzy search only on those documents that matches the narrowing query?  
I've tried using a filtered query but it doesn't seem to change the  
running time of the fuzzy search at all. The filtered query still takes  
10-20 s. Here's what I have tried so far:

{  
query:{  
filtered:{  
query:{text:{"b":...}},  
filter:{query:{fuzzy:{"a":{value:...}}}}  
}  
}  
}

Is there something I'm doing wrong here? I'm using version 0.18.7.

/Niklas

---

<div class="post-metadata">

**Author:** ![AEvar\_Arnfjord\_Bjarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aevar_arnfjord_bjarm/32/2746_2.png) [@AEvar\_Arnfjord\_Bjarm](https://discuss.elastic.co/u/AEvar_Arnfjord_Bjarm)\
**Post date:** [February 20, 2012, 11:50pm UTC](https://discuss.elastic.co/t/narrowing-down-search-space-for-fuzzy-searches/6760/2 "2012-02-20T23:50:35Z")

</div>

Fuzzy inherently entails brute force, have you looked into whether you can  
use more efficient methods like ngram indexes instead?

---

<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:38am UTC](https://discuss.elastic.co/t/narrowing-down-search-space-for-fuzzy-searches/6760/3 "2017-07-06T03:38:43Z")

</div>

Closed on July 6, 2017, 3:38am UTC


