How to set a lowercase analyzer

i have an index that containes a field with the value test.
somtimes the field containes : "Test" or "TEST" or "test"

i need to do a bool query that matches all three ocations.
i read that i can do it with lowercase analyzer
i could not figure out how to set it up

Any help?

Elasticsearch does that by default with the standard analyzer.

yes eventually i managed to do it
but the field type must be text and analyzed
thank :slight_smile:

is there a way to query (with bool) incasesensitive?

i actually managed to do that with bool and query string:

  "query": {
    "bool": {
      "must": [
          "query_string": {
            "query": "FIELD:*STRING*",
            "analyze_wildcard": true

this will search for the string in a non-case sensitive way (for an analyzed field)

Note that using a leading wildcard is really discouraged.

Why not using a match query instead?

To be honest
I looked how kibana does the same request and it uses query_string
what's the benefit of using match query over query_string in this case?

I see. query_string is ok but I'd not use wildcard if possible.

I'm afraid it is not possible.
The entire purpose of the program using this query is to search a string or a part of a string in a certain field (which can be very large) - so we must use wildcards .

Ngrams wouldn't work?

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