# Wildcard query on analyzed fields

**URL:** <https://discuss.elastic.co/t/wildcard-query-on-analyzed-fields/59313>\
**Category:** Elasticsearch\
**Created:** [August 30, 2016, 1:07pm UTC](https://discuss.elastic.co/t/wildcard-query-on-analyzed-fields/59313 "2016-08-30T13:07:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nrmohta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nrmohta/32/120038_2.png) [@nrmohta](https://discuss.elastic.co/u/nrmohta)\
**Post date:** [August 30, 2016, 1:07pm UTC](https://discuss.elastic.co/t/wildcard-query-on-analyzed-fields/59313/1 "2016-08-30T13:07:07Z")

</div>

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.
```

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [August 30, 2016, 3:11pm UTC](https://discuss.elastic.co/t/wildcard-query-on-analyzed-fields/59313/2 "2016-08-30T15:11:44Z")

</div>

Hi @nrmohta,

> [@nrmohta](#):
>
> Is there any way we can enable wildcard query on analyzed field ?

No.

Elasticsearch offers a [rich query DSL](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html) so I am confident there is query that matches your needs. 🙂

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

Daniel

---

<div class="post-metadata">

**Author:** ![nrmohta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nrmohta/32/120038_2.png) [@nrmohta](https://discuss.elastic.co/u/nrmohta)\
**Post date:** [August 30, 2016, 4:33pm UTC](https://discuss.elastic.co/t/wildcard-query-on-analyzed-fields/59313/3 "2016-08-30T16:33:27Z")

</div>

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](http://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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:23pm UTC](https://discuss.elastic.co/t/wildcard-query-on-analyzed-fields/59313/4 "2017-07-05T22:23:58Z")

</div>


