# How to do exact match

**URL:** <https://discuss.elastic.co/t/how-to-do-exact-match/11422>\
**Category:** Elasticsearch\
**Created:** [April 2, 2013, 11:15pm UTC](https://discuss.elastic.co/t/how-to-do-exact-match/11422 "2013-04-02T23:15:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Chambers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matt_chambers/32/607_2.png) [@Matt\_Chambers](https://discuss.elastic.co/u/Matt_Chambers)\
**Post date:** [April 2, 2013, 11:15pm UTC](https://discuss.elastic.co/t/how-to-do-exact-match/11422/1 "2013-04-02T23:15:41Z")

</div>

Hey,

Thanks for answering all my other questions, getting close to actually  
releasing this, but I'm running into this issue trying to recreate some  
MySQL behaviour. Currenty people expect nothing to be fuzzy. If I search  
for "Bilbo", I should only get records with the exact word Bilbo.

I'm setting up a keywords field with a bunch of words the application is  
generating in a unit test.

```
             "keywords": {
                "index_name": "keyword",
                "type": "multi_field",
                "fields": {
                    "keywords": {
                        "index_analyzer": "ngram_index_analyzer",
                        "type": "string"
                    },
                    "untouched": {
                        "type": "string",
                        "index": "not_analyzed"
                    }
                }
            },

```

What the data looks like:

keywords: [

- test
- testProduct
- product
- 8b9e7e65948298107f299cccb74836ac

]

I've tried querying for this record using the UUID value an inQuery,  
MatchQuery,TermQuery, etc. So far I either get everything or nothing.

QueryBuilders.inQuery("keywords.untouched", words).minimumMatch(words.length  
);

What I need to do is search for a list of strings and get only entries  
where the exact strings exist in the keywords.untouched field.

-Matt

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [April 3, 2013, 5:34am UTC](https://discuss.elastic.co/t/how-to-do-exact-match/11422/2 "2013-04-03T05:34:44Z")

</div>

Just want to check. You are talking about unit testing. How do you write your test?  
Index then Search?  
Or  
Index, Refresh then Search?

Could you share your test?

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 3 avr. 2013 à 01:15, Matt Chambers [yougotrooted@gmail.com](mailto:yougotrooted@gmail.com) a écrit :

Hey,

Thanks for answering all my other questions, getting close to actually releasing this, but I'm running into this issue trying to recreate some MySQL behaviour. Currenty people expect nothing to be fuzzy. If I search for "Bilbo", I should only get records with the exact word Bilbo.

I'm setting up a keywords field with a bunch of words the application is generating in a unit test.

```
             "keywords": {
                "index_name": "keyword",
                "type": "multi_field",
                "fields": {
                    "keywords": {
                        "index_analyzer": "ngram_index_analyzer",
                        "type": "string"
                    },
                    "untouched": {
                        "type": "string",
                        "index": "not_analyzed"
                    }
                }
            },

```

What the data looks like:

keywords: [  
test  
testProduct  
product  
8b9e7e65948298107f299cccb74836ac  
]

I've tried querying for this record using the UUID value an inQuery, MatchQuery,TermQuery, etc. So far I either get everything or nothing.

QueryBuilders.inQuery("keywords.untouched", words).minimumMatch(words.length);

What I need to do is search for a list of strings and get only entries where the exact strings exist in the keywords.untouched field.

-Matt

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:43am UTC](https://discuss.elastic.co/t/how-to-do-exact-match/11422/3 "2017-07-06T02:43:08Z")

</div>


