Facet Filter Confusion

Hi,

I just want to apply a filter to the query AND to the facets. When I do:

{"query":{"query_string":{"query":"userinput someField:someValue"}}

  • several facets!
    }

this works and is fast!

But I hoped to make it even faster when doing a filtered query which could
be better cached (!?). So I tried:

{"query":{
"filtered": {
"query":{"query_string": {"query":"userinput"}},
"filter":{ "term":{"someField":"someValue"}}
}}

  • several facets!
    }

which is at least 10 times slower on my machine** for my index.
Is it because the filtered part will be called after the facets have been
executed?
bigdesk shows enough free RAM

I think I could probably put the filter into every facet via facet_filter to
make it cached and fast,
but is it really that complicated?

Regards,
Peter.

** using jdk1.6.0_26 on ubuntu with elasticsearch 0.19.8

--

Hey,

forgot to post the solution here. First, the provided information was not
sufficient, sorry.
We had a combined "and" filter which was causing the slow response.
(A simple term filter is still 2 times faster then the query_string
equivalent)

But the thing with the "and" filter was still strange. And we fixed it. We
just replaced the "and" with a "bool" filter (must). Now 3 times faster!

Why are they so different?

Regards,
Peter.

On Thursday, January 10, 2013 6:21:13 PM UTC+1, Karussell wrote:

Hi,

I just want to apply a filter to the query AND to the facets. When I do:

{"query":{"query_string":{"query":"userinput someField:someValue"}}

  • several facets!
    }

this works and is fast!

But I hoped to make it even faster when doing a filtered query which could
be better cached (!?). So I tried:

{"query":{
"filtered": {
"query":{"query_string": {"query":"userinput"}},
"filter":{ "term":{"someField":"someValue"}}
}}

  • several facets!
    }

which is at least 10 times slower on my machine** for my index.
Is it because the filtered part will be called after the facets have been
executed?
bigdesk shows enough free RAM

I think I could probably put the filter into every facet via facet_filter
to make it cached and fast,
but is it really that complicated?

Regards,
Peter.

** using jdk1.6.0_26 on ubuntu with elasticsearch 0.19.8

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

The boolean filter can use the cached term bitsets and the and/or/not
filters don't.

On Thu, Feb 14, 2013 at 6:52 AM, Karussell tableyourtime@gmail.com wrote:

Hey,

forgot to post the solution here. First, the provided information was not
sufficient, sorry.
We had a combined "and" filter which was causing the slow response.
(A simple term filter is still 2 times faster then the query_string
equivalent)

But the thing with the "and" filter was still strange. And we fixed it. We
just replaced the "and" with a "bool" filter (must). Now 3 times faster!

Why are they so different?

Regards,
Peter.

On Thursday, January 10, 2013 6:21:13 PM UTC+1, Karussell wrote:

Hi,

I just want to apply a filter to the query AND to the facets. When I do:

{"query":{"query_string":{"query":"userinput someField:someValue"}}

  • several facets!
    }

this works and is fast!

But I hoped to make it even faster when doing a filtered query which could
be better cached (!?). So I tried:

{"query":{
"filtered": {
"query":{"query_string": {"query":"userinput"}},
"filter":{ "term":{"someField":"someValue"}}
}}

  • several facets!
    }

which is at least 10 times slower on my machine** for my index.
Is it because the filtered part will be called after the facets have been
executed?
bigdesk shows enough free RAM

I think I could probably put the filter into every facet via facet_filter
to make it cached and fast,
but is it really that complicated?

Regards,
Peter.

** using jdk1.6.0_26 on ubuntu with elasticsearch 0.19.8

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Matt,

thanks! But is there an advantage of the and/or/not filters?

Regards,
Peter.

On Thursday, February 14, 2013 6:21:18 PM UTC+1, Matt Weber wrote:

The boolean filter can use the cached term bitsets and the and/or/not
filters don't.

On Thu, Feb 14, 2013 at 6:52 AM, Karussell <tabley...@gmail.com<javascript:>>
wrote:

Hey,

forgot to post the solution here. First, the provided information was
not
sufficient, sorry.
We had a combined "and" filter which was causing the slow response.
(A simple term filter is still 2 times faster then the query_string
equivalent)

But the thing with the "and" filter was still strange. And we fixed it.
We
just replaced the "and" with a "bool" filter (must). Now 3 times faster!

Why are they so different?

Regards,
Peter.

On Thursday, January 10, 2013 6:21:13 PM UTC+1, Karussell wrote:

Hi,

I just want to apply a filter to the query AND to the facets. When I
do:

{"query":{"query_string":{"query":"userinput someField:someValue"}}

  • several facets!
    }

this works and is fast!

But I hoped to make it even faster when doing a filtered query which
could

be better cached (!?). So I tried:

{"query":{
"filtered": {
"query":{"query_string": {"query":"userinput"}},
"filter":{ "term":{"someField":"someValue"}}
}}

  • several facets!
    }

which is at least 10 times slower on my machine** for my index.
Is it because the filtered part will be called after the facets have
been

executed?
bigdesk shows enough free RAM

I think I could probably put the filter into every facet via
facet_filter

to make it cached and fast,
but is it really that complicated?

Regards,
Peter.

** using jdk1.6.0_26 on ubuntu with elasticsearch 0.19.8

--
You received this message because you are subscribed to the Google
Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an
email to elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Peter

thanks! But is there an advantage of the and/or/not filters?

and/or process doc-by-doc, so they are useful for filters which don't
produce bitsets, especially if they are also heavy filters. For
instance, if you have a geo-distance filter, put it as the last filter
in an and|or clause

clint

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.