Using missing filter into query, right syntax?

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

--

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
http://www.elasticsearch.org/guide/reference/api/search/facets/index.html

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 filter
http://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

--

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

--

--

Are you able to get results without asking for facets?
I mean: "is your query/filter correct and gives you expected results?"

Perhaps, you can provide a full curl recreation?

Le 9 octobre 2012 à 14:11, pere roca ristol peroc79@gmail.com a écrit :

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
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 mailto: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
http://www.elasticsearch.org/guide/reference/api/search/facets/index.html

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 TYPE>" : {
               ...
           },

           "facet_filter" : {
               "term" : { "user" : "kimchy"}

           }
       }
   }

}

Note that this is different from a facet of the filter
http://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
mailto: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
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://www.scrutmydocs.org/
http://dev.david.pilato.fr/ http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--