Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A Match Query against a boolean field returns a result #5337

Closed
ericdcobb opened this issue Mar 4, 2014 · 2 comments
Closed

A Match Query against a boolean field returns a result #5337

ericdcobb opened this issue Mar 4, 2014 · 2 comments

Comments

@ericdcobb
Copy link

Using version 0.90.5.

Supplying a string in a match query against a boolean type field with its value set to 'true' will return a hit if the query is a non-empty string.

In the following example, the first query returns a result, the second does not.

PUT /test/test/1
{
    "hello" : true
}

POST /test/_search 
{
    "query": {
        "bool": {
            "minimum_number_should_match": 1,
            "should": [
               {"match": {
                  "hello": "foo"
               }}
            ]
        }
    }
}

POST /test/_search 
{
    "query": {
        "bool": {
            "minimum_number_should_match": 1,
            "should": [
               {"match": {
                  "hello": ""
               }}
            ]
        }
    }
}

Obviously this is a really dumb query 😄 .We are fixing our client to not build queries like this. This does seem like odd behavior though.

@imotov
Copy link
Contributor

imotov commented Mar 5, 2014

Currently null, "", "F", "false", "0", "off" and "no" is parsed as False. Everything else is True.

@ericdcobb
Copy link
Author

Thank you Igor.

@imotov imotov closed this as completed in b723ee0 Mar 5, 2014
imotov added a commit that referenced this issue Mar 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants