How to OR-query on multiple different fields?

Hi,

I'm trying to perform the following pseudo query:

where fieldV=1 and fieldW=2 and (fieldX=3 or fieldY=4 or fieldZ=5)

I've got fieldV and fieldW working through

"query":{
"bool":{
"must":[
{"query_string":{"query":"fieldV:"1""}},
{"query_string":{"query":"fieldW:"2""}},
]
}
},

but I don't know how to construct the OR-query.

I don't think I can use the OR-filter because I need the conditions to be
included in the query so I can use facets on the result set.

Any help is sooooo appreciated.

Thanks,
Ijonas.

--

Hi Ijonas

I don't think I can use the OR-filter because I need the conditions to
be included in the query so I can use facets on the result set.

Please could you send your example query with real field names and
values. I ask because you probably CAN use filters for a number of
fields (while still using facets). But it is difficult to know which
ones to filter on without knowing what the fields mean

ta

clint

--

With query_string, you can use Lucene syntax...

"query_string" : {
    "query" : "fieldV:1 AND fieldW:2 AND (fieldX:3 OR fieldY:4 OR 

fieldZ:5)"
}

On Friday, January 18, 2013 2:10:22 PM UTC-5, Ijonas Kisselbach wrote:

Hi,

I'm trying to perform the following pseudo query:

where fieldV=1 and fieldW=2 and (fieldX=3 or fieldY=4 or fieldZ=5)

I've got fieldV and fieldW working through

"query":{
"bool":{
"must":[
{"query_string":{"query":"fieldV:"1""}},
{"query_string":{"query":"fieldW:"2""}},
]
}
},

but I don't know how to construct the OR-query.

I don't think I can use the OR-filter because I need the conditions to be
included in the query so I can use facets on the result set.

Any help is sooooo appreciated.

Thanks,
Ijonas.

--

Thanks both Clinton and egaumer!

I managed to solve this problem with the query+string + Lucene syntax
suggested by egaumer. Dead simple.

--