Query_string in 5.1 is case sensitive

Hi There,

I am using AWS ElasticSearch Service. at first i had version "2.3". when using "query_string to search for a field as follows. even authorlast name starts with uppercase "S" , but it is mapped to lowercase as per explanation result below, so i got the result. but after switch to ES "5.1" this no longer work. it does not map "S" to lowercase "s" so i did not get result. is any change in query_string parsing in 2.3 than 5.1?

{
    "query": {
        "bool": {
            "must": [{
                "query_string": {
                    "query": "S?ith",
                    "fields": ["authlast"]
                }
            }]
        }
    }
}
"explanations": [
    {
      "index": "myindex",
      "valid": true,
      "explanation": "+authlast:S?ith"
    }
  ]

Thanks

Have a look at this. It looks like it should work if the analyzer for the field lowercases it.

Yes, i have a custom analyzer that looks as follows

"field_analyzer":
{
"type": "custom",
"char_filter": "html_strip",
"tokenizer": "whitespace",
"filter": [ "lowercase", "asciifolding", "trim" ]
}

field:

"authfirst":
{
"type": "string",
"analyzer": "field_analyzer",
"search_analyzer": "field_analyzer"
}

still does not work!!!?

You should really wrap code in ``` so it is more readable.

Could you try setting analyze_wildcard to true in the query_string?

added as follows, still no difference

{
    "query": {
        "bool": {
            "must": [{
                "query_string": {
                    "query": "S?ith",
                    "fields": ["authfirst"],
                    "analyzer": "field_analyzer",
                    "analyze_wildcard": true,
                    "lowercase_expanded_terms": "true"
                   
                }
            }]
        }
    }

}

examination Output:

"explanations": [
    {
      "index": "myindex",
      "valid": true,
      "explanation": "+authfirst:S?ith"
    }
  ]
}

Weird. Can you file an issue? I'm fairly sure analyze_wildcard should make that work. At least it looks like it should from the docs.

Thanks Nik for your quick response. am still newbie to ES forum, please could you provide me details how to file an issue? the interesting thing i have same mapping file that used for ES "2.3" and that worked fine, but in ES "5.1" does not work!!!!

The text in the issue box on https://github.com/elastic/elasticsearch/issues/new should guide you through it pretty well. It is super important to have steps to reproduce the issue - either in the form of CONSOLE syntax or curl commands that you could paste into bash.

Thanks Nik. i have opened an issue @ https://github.com/elastic/elasticsearch/issues/23620

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.