Thanks, Clint! Yeah I've been checking those as best I can today. I'm
a little new to ES so it's not jumping out at me at the moment
The search API accepts 'query' and 'filter' parameters, eg:
{
query: { match_all: {}
}
The count API accepts a query, eg:
{
match_all: {}
}
Inconsistent, I know... but that's how it is at the moment
clint
On Monday, April 16, 2012 2:14:20 PM UTC-4, Clinton Gormley wrote:
Hiya
>
>
{"filter":{"and":[{"term":{"SID":"49"}},{"term":{"BI":"true"}},{"term":{"TA":"Tag Test"}},{"term":{"TY":"2"}},{"query":{"query_string":{"fields":["RE","SU"],"query":""john@test.com"","default_operator":"AND"}}}]}}
Look at the docs for search
http://www.elasticsearch.org/guide/reference/api/search/request-body.html and for count http://www.elasticsearch.org/guide/reference/api/count.html
and you'll soon see the difference
clint
Is it even possible to filter "queries", then, for _count?
Yes, that's what the filtered query
and the constant score query
are used for.
The 'filter' param on the search API is used for filtering results AFTER
facets have been calculated. For other uses of filters, it is better to
use the filtered or constant score queries instead.
clint
On Monday, April 16, 2012 3:05:25 PM UTC-4, JP Toto wrote:
Ohhh I see. Gotcha. I appreciate the tip. Just have to figure
out how to rewrite this now for _count. Thanks!
On Monday, April 16, 2012 2:39:57 PM UTC-4, Clinton Gormley
wrote:
On Mon, 2012-04-16 at 11:33 -0700, JP Toto wrote:
> Thanks, Clint! Yeah I've been checking those as best
I can today. I'm
> a little new to ES so it's not jumping out at me at
the moment :-(
The search API accepts 'query' and 'filter'
parameters, eg:
{
query: { match_all: {}
}
The count API accepts a query, eg:
{
match_all: {}
}
Inconsistent, I know... but that's how it is at the
moment
clint
>
> On Monday, April 16, 2012 2:14:20 PM UTC-4, Clinton
Gormley wrote:
> Hiya
> >
> >
>
{"filter":{"and":[{"term":{"SID":"49"}},{"term":{"BI":"true"}},{"term":{"TA":"Tag Test"}},{"term":{"TY":"2"}},{"query":{"query_string":{"fields":["RE","SU"],"query":"\"john@test.com\"","default_operator":"AND"}}}]}}
>
> Look at the docs for search
>
http://www.elasticsearch.org/guide/reference/api/search/request-body.html and for count http://www.elasticsearch.org/guide/reference/api/count.html
> and you'll soon see the difference
>
> clint
>
The 'filter' param on the search API is used for filtering results AFTER
facets have been calculated. For other uses of filters, it is better to
use the filtered or constant score queries instead.
clint
On Monday, April 16, 2012 3:05:25 PM UTC-4, JP Toto wrote:
Ohhh I see. Gotcha. I appreciate the tip. Just have to figure
out how to rewrite this now for _count. Thanks!
On Monday, April 16, 2012 2:39:57 PM UTC-4, Clinton Gormley
wrote:
On Mon, 2012-04-16 at 11:33 -0700, JP Toto wrote:
> Thanks, Clint! Yeah I've been checking those as best
I can today. I'm
> a little new to ES so it's not jumping out at me at
the moment :-(
The search API accepts 'query' and 'filter'
parameters, eg:
{
query: { match_all: {}
}
The count API accepts a query, eg:
{
match_all: {}
}
Inconsistent, I know... but that's how it is at the
moment
clint
>
> On Monday, April 16, 2012 2:14:20 PM UTC-4, Clinton
Gormley wrote:
> Hiya
> >
> >
>
One more thing, you can use search_type set to count in the search request
URI, and execute regular search requests and get back just the count.
Effectively, it will be as performant as the count API.
The 'filter' param on the search API is used for filtering results AFTER
facets have been calculated. For other uses of filters, it is better to
use the filtered or constant score queries instead.
clint
On Monday, April 16, 2012 3:05:25 PM UTC-4, JP Toto wrote:
Ohhh I see. Gotcha. I appreciate the tip. Just have to figure
out how to rewrite this now for _count. Thanks!
On Monday, April 16, 2012 2:39:57 PM UTC-4, Clinton Gormley
wrote:
On Mon, 2012-04-16 at 11:33 -0700, JP Toto wrote:
> Thanks, Clint! Yeah I've been checking those as best
I can today. I'm
> a little new to ES so it's not jumping out at me at
the moment :-(
The search API accepts 'query' and 'filter'
parameters, eg:
{
query: { match_all: {}
}
The count API accepts a query, eg:
{
match_all: {}
}
Inconsistent, I know... but that's how it is at the
moment
clint
>
> On Monday, April 16, 2012 2:14:20 PM UTC-4, Clinton
Gormley wrote:
> Hiya
> >
> >
>
{"filter":{"and":[{"term":{"**
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.