# Best method for exact matches only

**URL:** <https://discuss.elastic.co/t/best-method-for-exact-matches-only/245300>\
**Category:** Elasticsearch\
**Created:** [August 17, 2020, 6:12pm UTC](https://discuss.elastic.co/t/best-method-for-exact-matches-only/245300 "2020-08-17T18:12:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![blewis1337](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@blewis1337](https://discuss.elastic.co/u/blewis1337)\
**Post date:** [August 17, 2020, 6:12pm UTC](https://discuss.elastic.co/t/best-method-for-exact-matches-only/245300/1 "2020-08-17T18:12:15Z")

</div>

We currently use elastic search for our magento storefront. We are a B2B style company and our customers search for very specific terms and skus when using our site. We have set all our items up with a number of meta\_keywords and all items have a unique sku. We want our search engine to only return exact matches to the search query and not display items that may contain part of a word.

So in example if a customer looks up a sku of 01-11-1111 we want the search results to only show results for that sku not all items that contain 01-11-XXXX. Or if a customer searches gloves we dont want it to return items tagged with "glove box" or "gloves combo" just items tagged with "gloves"

---

<div class="post-metadata">

**Author:** ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)\
**Post date:** [August 17, 2020, 6:55pm UTC](https://discuss.elastic.co/t/best-method-for-exact-matches-only/245300/2 "2020-08-17T18:55:23Z")

</div>

The SKU needs to be mapped as a [keyword](https://www.elastic.co/guide/en/elasticsearch/reference/current/keyword.html). When doing the search you need to do a [term query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html).

Does that help you get started on this?

---

<div class="post-metadata">

**Author:** ![blewis1337](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@blewis1337](https://discuss.elastic.co/u/blewis1337)\
**Post date:** [August 18, 2020, 1:54pm UTC](https://discuss.elastic.co/t/best-method-for-exact-matches-only/245300/3 "2020-08-18T13:54:27Z")

</div>

Yes this does help me as a jump of point thank you very much.

---

<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:** [September 15, 2020, 1:54pm UTC](https://discuss.elastic.co/t/best-method-for-exact-matches-only/245300/4 "2020-09-15T13:54:30Z")

</div>

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