termQuery vs. termFilter

Which query should I prefer? This filter query:

srb.setQuery(QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(),
FilterBuilders.termFilter("someField", "someValue")));

or this termQuery:

srb.setQuery(QueryBuilders.termQuery("someField", "someValue"));

Regarding performance and memory? Or is there even a better way of
doing this?

Regards,
Peter.

On Tue, 2011-07-12 at 06:44 -0700, Karussell wrote:

Which query should I prefer? This filter query:

Use a term query if the terms you are looking for should affect the
_score (relevance). If it should just exclude all docs except for those
that match, use a term filter.

clint

Ok, I do not need the score. So, can I even go with scan search + the
termFilter or which one would be the fastest?

I'm expecting only one or two results ...

On 12 Jul., 15:50, Clinton Gormley clin...@iannounce.co.uk wrote:

On Tue, 2011-07-12 at 06:44 -0700, Karussell wrote:

Which query should I prefer? This filter query:

Use a term query if the terms you are looking for should affect the
_score (relevance). If it should just exclude all docs except for those
that match, use a term filter.

clint

If its a term value that is easily cacheable (has a "small" amount of values, and its going to be repeated), then a term filter is the way to go usually. If not, a term query.

On Tuesday, July 12, 2011 at 5:16 PM, Karussell wrote:

Ok, I do not need the score. So, can I even go with scan search + the
termFilter or which one would be the fastest?

I'm expecting only one or two results ...

On 12 Jul., 15:50, Clinton Gormley <clin...@iannounce.co.uk (http://iannounce.co.uk)> wrote:

On Tue, 2011-07-12 at 06:44 -0700, Karussell wrote:

Which query should I prefer? This filter query:

Use a term query if the terms you are looking for should affect the
_score (relevance). If it should just exclude all docs except for those
that match, use a term filter.

clint

ok. thanks. and do you think that a score-less search could improve
performance or is it neglectable for only a few docs for each value of
that field?

Regards,
Peter.

On 12 Jul., 19:09, Shay Banon shay.ba...@elasticsearch.com wrote:

If its a term value that is easily cacheable (has a "small" amount of values, and its going to be repeated), then a term filter is the way to go usually. If not, a term query.

On Tuesday, July 12, 2011 at 5:16 PM, Karussell wrote:

Ok, I do not need the score. So, can I even go with scan search + the
termFilter or which one would be the fastest?

I'm expecting only one or two results ...

On 12 Jul., 15:50, Clinton Gormley <clin...@iannounce.co.uk (http://iannounce.co.uk)> wrote:

On Tue, 2011-07-12 at 06:44 -0700, Karussell wrote:

Which query should I prefer? This filter query:

Use a term query if the terms you are looking for should affect the
_score (relevance). If it should just exclude all docs except for those
that match, use a term filter.

clint

Negligible, and use query_and_fetch search_type if you want all.

On Tuesday, July 12, 2011 at 8:17 PM, Karussell wrote:

ok. thanks. and do you think that a score-less search could improve
performance or is it neglectable for only a few docs for each value of
that field?

Regards,
Peter.

On 12 Jul., 19:09, Shay Banon <shay.ba...@elasticsearch.com (http://elasticsearch.com)> wrote:

If its a term value that is easily cacheable (has a "small" amount of values, and its going to be repeated), then a term filter is the way to go usually. If not, a term query.

On Tuesday, July 12, 2011 at 5:16 PM, Karussell wrote:

Ok, I do not need the score. So, can I even go with scan search + the
termFilter or which one would be the fastest?

I'm expecting only one or two results ...

On 12 Jul., 15:50, Clinton Gormley <clin...@iannounce.co.uk (http://iannounce.co.uk)> wrote:

On Tue, 2011-07-12 at 06:44 -0700, Karussell wrote:

Which query should I prefer? This filter query:

Use a term query if the terms you are looking for should affect the
_score (relevance). If it should just exclude all docs except for those
that match, use a term filter.

clint