I'm running on ES 5.1.2 currently, though I've seen this behavior on 2.x versions as well:
When I have an index with a mapping containing a boolean
datatype, it seems that when executing a query_string
or simple_query_string
query with "lenient": true
, all items that have values which are Truthy (as defined as they opposite of Falsey per Boolean datatype) will match.
Example mapping:
{
"index": {
"mappings": {
"properties": {
"string_val": {
"type": "string"
},
"bool_val": {
"type": "boolean"
}
}
}
}
}
Example query_string
query:
{
"query": {
"query_string": {
"fields": ["string_val", "bool_val"],
"lenient": true,
"query": "An Arbitrary String"
}
}
}
This will match all documents for which bool_val
has the value true
.
I see the dilemma of how to treat such a query with the use of "lenient": true
, however, particularly as the note in the above referenced page on boolean datatypes I would have hoped that as of 5.1.1 that query string would match neither true nor false values for the boolean field.
Unfortunately, in my full use case, I cannot restrict the query to particular fields, and thus I need lenient.
Any suggestions?
Thanks.