# Query Filter on not\_analyzed array field does not match whitespace/hyphen

**URL:** <https://discuss.elastic.co/t/query-filter-on-not-analyzed-array-field-does-not-match-whitespace-hyphen/8661>\
**Category:** Elasticsearch\
**Created:** [August 7, 2012, 11:06pm UTC](https://discuss.elastic.co/t/query-filter-on-not-analyzed-array-field-does-not-match-whitespace-hyphen/8661 "2012-08-07T23:06:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bashir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bashir/32/2780_2.png) [@bashir](https://discuss.elastic.co/u/bashir)\
**Post date:** [August 7, 2012, 11:06pm UTC](https://discuss.elastic.co/t/query-filter-on-not-analyzed-array-field-does-not-match-whitespace-hyphen/8661/1 "2012-08-07T23:06:47Z")

</div>

I've been scratching my head for some time on this one. Major brownie points for any guidance:  
I have mapping:  
mapping :show =\> { :properties =\> {...  
:tags =\> {:type =\> 'string', :index\_name =\> 'tag', :boost =\> 80, :index =\> 'not\_analyzed'},  
...}}

tags is an array of tags. For example:  
"tags":["rails","ruby on rails"]

I run a query as such(notice no results):

curl -X GET "[http://localhost:9200/magic/\_search?from=0&page=1&per\_page=24&size=24pretty=true](http://localhost:9200/magic/_search?from=0&page=1&per_page=24&size=24pretty=true)" -d '{"sort":[[{"score":"desc"}]],"filter":{"terms":{"tags":["ruby on rails"]}},"size":24,"from":0}'  
{  
"took" : 0,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 0,  
"max\_score" : null,  
"hits" : []  
}

If I run it with "tags":["ruby"], it will match all documents that are tagged "ruby" and all documents tagged "ruby on rails". I don't want a substring search, I need an exact search and I thought if the field is "not\_analyzed" that it would be an exact match. How to do this the right way. Notice that this is a filter and not query.

---

<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 6, 2017, 3:17am UTC](https://discuss.elastic.co/t/query-filter-on-not-analyzed-array-field-does-not-match-whitespace-hyphen/8661/2 "2017-07-06T03:17:20Z")

</div>


