thanks for the info. I am not sure that I can use 'missing' inside a
facet_filter, at least for me it´s not working...even if it gives no error
on console (see new curl below)
I have occurrences that don´t have decimalLatitude field, and i want to
exlude them from the facet.
curl -XGET http://my_url:9200/idx_occurrence/Occurren/_search?pretty=true-d
'{ "query": { "query_string" :{ "fields" : ["dataset"], "query": "3",
"default_operator" : "AND" } }, "facets": { "test": { "terms": { "field"
:["kingdom_interpreted"],"size" : 5 }, "facet_filter" :
{"missing":{"field":"decimalLatitude"}} } } }'
2012/10/9 David Pilato david@pilato.fr
**
One thing you have to know is that filter are not applied to facets.
So, if you want to reduce your terms in facet with a filter, you have to
ask for it:
Elasticsearch Platform — Find real-time answers at scale | Elastic
Facet Filter
All facets can be configured with an additional filter (explained in the
Query DSL http://www.elasticsearch.org/guide/reference/query-dsl section),
which will reduce the documents they use for computing results. An
example with a term filter:
{
"facets" : {
"" : {
"" : {
...
},
"facet_filter" : {
"term" : { "user" : "kimchy"}
}
}
}
}
Note that this is different from a facet of the filterhttp://www.elasticsearch.org/guide/reference/api/search/facets/filter-facet.html
type.
Does it help ?
David.
Le 9 octobre 2012 à 13:34, pere roca ristol peroc79@gmail.com a écrit :
it's the first time I use the 'missing' parameter and I am not sure if I
am doing something wrong as i am not getting what i expect.
Can someone tell me if the missing condition is correctly integrated in
this query? it should created 5 facets, counting for each one only the
occurrences for which decimallatitude field is 'not set in the index' or
its value is null.
curl -XGET
http://my_url:9200/idx_occurrence/Occurrene/_search?pretty=true -d '{
"filter":{"missing":{"field":"decimallatitude","existence" :
true,"null_value" : true}},"query": { "query_string" :{ "fields" :
["dataset"], "query": "3", "default_operator" : "AND" } }, "facets": {
"test": { "terms": { "field" :["kingdom_interpreted"],"size" : 5 } } } }'
thanks in advance,
Pere
--
--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
--
--