Hello together,
does anyone know what is the exact difference between the following 2
requests? Both requests returns the same result.
I read the elasticsearch docs about filter and query, but I didn't
understand the exact difference.
What is faster? What internally happends? What is the right way?
From the docs about filters:
"As a general rule, filters should be used instead of queries ... for
queries on exact values"
But I found tons of examples that uses "query -> term -> key -> value". Why
is it so?
curl "http://localhost:9200/myapp/event/_search?pretty=true" -d '{
"filter" : {
"and" : [
{
"term" : {
"user_id" : "2"
}
},{
"range" : {
"time" : {
"from" : 1385655592000,
"to" : 1386260392000
}
}
}
]
},
"sort" : {
"time" : { "order" : "desc" }
}
}'
curl "http://localhost:9200/myapp/event/_search?pretty=true" -d '{
"query" : {
"filtered" : {
"query" : {
"term" : { "user_id" : "2" }
},
"filter" : {
"range" : {
"time" : {
"from" : 1385655592000,
"to" : 1386260392000
}
}
}
}
},
"sort" : {
"time" : { "order" : "desc" }
}
}'
Cheers
Jonny
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/df6ed558-1b8c-45cb-905c-152963870819%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.