I have been banging my head against the wall for hours to try and
figure out how to filter a document based on the value of a boolean.
It seems straight forward, but these queries do not seem to be
working. Here is the query I'm using:
:query => {
:filtered => {
:query => {
:custom_score => {
:query => {
:bool => {
:should => {
:query_string => {
:query => "query",
:fields => ["field1", "field2"]
}
},
:must => {
:nested => {
:path => "path", :query => {
:flt => {
:fields => ["field3"], :like_text =>
"query"
}
}
}
}
}
},
:script => "_score * doc['admin_score'].value"
}
},
:filter => {
:bool => {
:must_not => {
:term => {
:show => 0
}
}
}
}
}
},
:size => 20
I convert this syntax into JSON before sending. I only want to return
results where object.show == true, but documents where show == false
are getting through the filter. Here's what the mapping for the
"show" field:
"show":{"type":"boolean"}
What am I doing wrong???