# How to filter values with wildcard symbols?

**URL:** <https://discuss.elastic.co/t/how-to-filter-values-with-wildcard-symbols/111841>\
**Category:** Elasticsearch\
**Created:** [December 14, 2017, 6:54pm UTC](https://discuss.elastic.co/t/how-to-filter-values-with-wildcard-symbols/111841 "2017-12-14T18:54:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![asafonov303](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/asafonov303/32/25594_2.png) [@asafonov303](https://discuss.elastic.co/u/asafonov303)\
**Post date:** [December 14, 2017, 6:54pm UTC](https://discuss.elastic.co/t/how-to-filter-values-with-wildcard-symbols/111841/1 "2017-12-14T18:54:49Z")

</div>

Hi. I'm newbee in elasticsearch. My question is what's wrong with the query I'm using:  
Model (partially):

> ```
> {
> "hello_world_index" : {
> "mappings" : {
> "entity" : {
> "dynamic" : "strict",
> "properties" : {
> "employees" : {
> "properties" : {
> "name" : {
> "type" : "text",
> "fields" : {
> "raw" : {
> "type" : "keyword"
> }}}}}}}}}}
> 
> ```

Data that exists:

> "employees" : [  
> {  
> "id" : "2",  
> "name" : "b?ob\*",  
> "type" : 0  
> }  
> ],

The query I send:  
`POST -d ' {"query": {"bool":{"must":[{"bool":{"should":[{"match_phrase_prefix":{"employees.name":{"query":"b?ob*"}}}]}}]}}}'`  
returns this record fine  
But when I use the following queries I expect to see no result:

> ```
> "query":"b\\*ob"
> "query":"\"b*ob"\"
> 
> ```

but I get the same data.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 14, 2017, 9:54pm UTC](https://discuss.elastic.co/t/how-to-filter-values-with-wildcard-symbols/111841/2 "2017-12-14T21:54:03Z")

</div>

The problem is that you are using the default analyzer where you should may be not use any.

Try to search in `name.raw`

---

<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:** [January 11, 2018, 9:54pm UTC](https://discuss.elastic.co/t/how-to-filter-values-with-wildcard-symbols/111841/3 "2018-01-11T21:54:15Z")

</div>

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