moocow
(moocow)
January 20, 2013, 1:57am
1
Hello,
is it possible to combine filter and query?
e.g.
filter -> category:"Movies" and query_string -> query = ((horror AND movie)
or (horror OR movie))
This will first filter to category Movies (fast) then perform the query on
the results of the filter match.
Im using the following to do the query, If i can do the above, how can I
add the filter part in?
curl -XGET 'http://localhost:9200/lists/list/_search ' -d '{
"query":{
"query_string" : {
"query" : "(user:lu) AND ((horror AND movie) OR (horror OR movie))",
"analyzer":"stem"
}
}
}'
Any help is very much appreciated
Lu
--
egaumer
(egaumer)
January 20, 2013, 3:27am
2
You can use a FilteredQuery...
{
"query": {
"filtered": {
"query": {
"query_string": {
"query": "(user:lu) AND ((horror AND movie) OR (horror
OR movie))"
}
},
"filter": {
"terms": {
"category": [
"Movies"
]
}
}
}
}
}
On Saturday, January 19, 2013 8:57:47 PM UTC-5, moocow wrote:
Hello,
is it possible to combine filter and query?
e.g.
filter -> category:"Movies" and query_string -> query = ((horror AND
movie) or (horror OR movie))
This will first filter to category Movies (fast) then perform the query on
the results of the filter match.
Im using the following to do the query, If i can do the above, how can I
add the filter part in?
curl -XGET 'http://localhost:9200/lists/list/_search ' -d '{
"query":{
"query_string" : {
"query" : "(user:lu) AND ((horror AND movie) OR (horror OR movie))",
"analyzer":"stem"
}
}
}'
Any help is very much appreciated
Lu
--