Wildcard query on analyzed fields

Mapping :
"analysis": {
"analyzer": {
"itda": {
"filter": ["lowercase"],
"tokenizer": "keyword"
}
}
}
}

"store_all_string_fields_template" : {
            "match" : "*",
            "match_matching_type" : "string",
            "mapping" : {
                "store" : "yes",
                "index_options" : "docs",
                "omit_norms" : "true",
                "analyzer": "itda",
                "fields" : {
                    "raw" : {
                        "type" : "string",
                        "index" : "not_analyzed"
                    }
                }
            }
        }
      }

Indexed Data : Collector (field name) and TestCollector (field value)

Query :

1. On not_analyzed field
"bool" : {
          "should" : {
            "wildcard" : {
              "Collector.raw" : "TestCollec*"
            }
          }
          
Giving proper results

2. On analyzed field
"bool" : {
          "should" : {
            "wildcard" : {
              "Collector" : "TestCollec*"
            }
          }
          
Problem : No results

From reading docs it seems wildcard queries does not worked on analyzed fields. It works only on not_analyzed fields thats why its working in 1st query. 

Is there any way we can enable wildcard query on analyzed field ? Please suggest.

Hi @nrmohta,

No.

Elasticsearch offers a rich query DSL so I am confident there is query that matches your needs. :slight_smile:

What problem are you trying to solve? Can you share a concrete example of your application's requirements?

Daniel

Basic requirement for us is to support case insensitive search on field value.
For that we have used multi fields in which
1.one field is analyzed with 'lowercase' filter and 'keyword' as tokenizer(to emit the entire input as a single output).
2.one field is not_analyzed

Now for case sensitive search we are using not_analyzed field and for case insensitive search we are using analyzed field.So far its working fine.
For wildcard queries case sensitive search is working fine as we are using not_analyzed field in it. But we are facing trouble while supporting case insensitive wildcard query search in this scenario on analyzed field.

Please suggest how can we support this feature.