Search exactly value in boolean fields


#1

Hi,

I have an index "test" with a field "is_boolean" boolean:

{
"test": {
"mappings": {
"default": {
"properties": {
"is_boolean": {
"type": "boolean"
}
}
}
}
}
}

I want to search this field for some values (I don't know apriori if they are integer, string, boolean or something else).

The search that I made is:

POST http://localhost:9200/test/default/_search
{
"query":
{
"term":{"is_boolean":"something"}
}
}

The problem is that the results contain all the elements with "is_boolean" set to "true".

Is there any way to modify my search in order to retrieve results only when I search for "true"/"false"?

I know it's a stupid example, but I summarized a lot what I'm doing. Also I don't want to retrieve what is in mapping.

Thank you,


#2

Hy,

Does anybody know how to fix this problem?

Thank you


(system) #3