Skip to content

Multi-match type exceptions in Query String Query #23210

@PhaedrusTheGreek

Description

@PhaedrusTheGreek

When querying across multiple fields of different types in Query String Query, if there is a mismatch between the data type of the query string and the data type of the queried field, then an exception occurs. When a similar search is run via multi_match, no issue is observed. Tested under ES 5.2.0

PUT /tester22/
{
   "mappings": {
      "test": {
         "properties": {
            "Product": {
               "properties": {
                  "Id": {
                     "type": "string"
                  },
                  "IsBlue": {
                     "type": "boolean"
                  },
                  "Inventory": {
                     "type": "long"
                  }
               }
            }
         }
      }
   }
}

POST /tester22/test
{
    "Product":{
        "Id": "asdf",
        "IsBlue" : false,
        "Inventory" : 234
    }
}

Results in number_format_exception:

GET /tester22/_search
{
   "query": {
       "query_string": {
          "query": "Product.\\*:asdf"
       }
   }
}

Works seamlessly:

GET /tester22/_search
{
 "query": {
        "multi_match": {
            "query":       "asdf",
            "type":        "cross_fields", 
            "operator":    "and",
            "fields":      [ "Product.*" ]
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search/SearchSearch-related issues that do not fall into other categories>bughelp wantedadoptme

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions