4

I am searching across multiple fields in a query using the * asterisk notation (Ex: I want all fields startings with source so I specify fields source.*) and I specify a query of foobar as string. I am using a Query String type query.

I keep getting a NumberFormatException and I have some fields in there with a mapping type of long and double.

Any idea how to go about this? I need to do a multi-field search.

My query is posted below:

{
    "query": {
        "bool": {
            "must": [{
                "query_string": {
                    "default_field": "source.*",
                    "query": "foobar"
                }
            }],
            "must_not": [],
            "should": []
        }
    },
    "from": 0,
    "size": 100000,
    "sort": [],
    "facets": {}
}
3
  • And you were expecting not to get an exception when trying to compare a string to a numeric field? Commented Jul 23, 2015 at 20:23
  • Can we see the mapping? Commented Jul 23, 2015 at 20:24
  • @bittusarkar I was hoping if there was a work around. I was expecting to get the exception. Commented Jul 23, 2015 at 20:25

1 Answer 1

7

set lenient to true to ignore format based failures

example :

"query_string": 
 {
      "default_field": "source.*",
      "query": "foobar",
      "lenient": true

 }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.