# Difference in filters

**URL:** <https://discuss.elastic.co/t/difference-in-filters/4157>\
**Category:** Elasticsearch\
**Created:** [March 25, 2011, 9:11am UTC](https://discuss.elastic.co/t/difference-in-filters/4157 "2011-03-25T09:11:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joaquin\_Cuenca\_Abela](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@Joaquin\_Cuenca\_Abela](https://discuss.elastic.co/u/Joaquin_Cuenca_Abela)\
**Post date:** [March 25, 2011, 9:11am UTC](https://discuss.elastic.co/t/difference-in-filters/4157/1 "2011-03-25T09:11:31Z")

</div>

Hi,

is there any significant difference in performance between having a  
term filter on a not analyzed property, and having a fquery filter on  
an analyzed property with \_cache = true, if the analyzer is only  
asciifolding and lowercasing and the property is always a single word?

Another related question, if the only goal of fquery is to wrap a  
query in a filter and cache the results, why can't the syntax be:

{ 'fquery': { 'query\_string': { ... } } }

Instead of the more verbose:

{ 'fquery': {  
'query: { 'query\_string': { ... } },  
'\_cache': true }  
}

--  
Joaquin Cuenca Abela -- [presspeople.com](http://presspeople.com): Fuentes de prensa y comunicados

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [March 25, 2011, 7:05pm UTC](https://discuss.elastic.co/t/difference-in-filters/4157/2 "2011-03-25T19:05:23Z")

</div>

It will be very similar (there will be additional cost for parsing the query string and applying the analysis each time, but should be pretty fast).

The reason for the more "complex" structure of filtered query is so you can define the \_cache parameter (and others).  
On Friday, March 25, 2011 at 11:11 AM, Joaquin Cuenca Abela wrote:

> Hi,
> 
> is there any significant difference in performance between having a  
> term filter on a not analyzed property, and having a fquery filter on  
> an analyzed property with \_cache = true, if the analyzer is only  
> asciifolding and lowercasing and the property is always a single word?
> 
> Another related question, if the only goal of fquery is to wrap a  
> query in a filter and cache the results, why can't the syntax be:
> 
> { 'fquery': { 'query\_string': { ... } } }
> 
> Instead of the more verbose:
> 
> { 'fquery': {  
> 'query: { 'query\_string': { ... } },  
> '\_cache': true }  
> }
> 
> --  
> Joaquin Cuenca Abela -- [presspeople.com](http://presspeople.com): Fuentes de prensa y comunicados

---

<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:09am UTC](https://discuss.elastic.co/t/difference-in-filters/4157/3 "2017-07-06T04:09:17Z")

</div>


