# Exact match for a string in elastic search

**URL:** <https://discuss.elastic.co/t/exact-match-for-a-string-in-elastic-search/59587>\
**Category:** Elasticsearch\
**Created:** [September 1, 2016, 6:05pm UTC](https://discuss.elastic.co/t/exact-match-for-a-string-in-elastic-search/59587 "2016-09-01T18:05:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ravinder](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ravinder/32/69362_2.png) [@ravinder](https://discuss.elastic.co/u/ravinder)\
**Post date:** [September 1, 2016, 6:05pm UTC](https://discuss.elastic.co/t/exact-match-for-a-string-in-elastic-search/59587/1 "2016-09-01T18:05:53Z")

</div>

I have indexed large pdf files into elastic search engine. I have analyzed this Unstructured Data with a snowball analyzer. this converts words like "running" to "run" using the snowball filter. but what if I want to search exactly for word "running" ?

I cannot go for using another field as these are larger files and can increase the index size in a larger extent.

So how can I use the snowball filter to use something like "preserver\_original". so that I can have original word preserved along with the filtered word.

is there any way or alternative way to analyze the field as per my requirement??

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [September 1, 2016, 7:23pm UTC](https://discuss.elastic.co/t/exact-match-for-a-string-in-elastic-search/59587/2 "2016-09-01T19:23:31Z")

</div>

The normal way to do this is with the [`fields`](https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html) parameter in the mapping. This is convenient because you can search for both fields and use a different boost value so you prefer exact matches to stemmed matches.

---

<div class="post-metadata">

**Author:** ![ravinder](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ravinder/32/69362_2.png) [@ravinder](https://discuss.elastic.co/u/ravinder)\
**Post date:** [September 1, 2016, 8:14pm UTC](https://discuss.elastic.co/t/exact-match-for-a-string-in-elastic-search/59587/3 "2016-09-01T20:14:09Z")

</div>

@nik9000 If I have like 1000 words common in fields after analyzing, wouldn't it affect the relevance ? As I have duplicate words in in the inverted index.

and is this same as [https://www.elastic.co/guide/en/elasticsearch/guide/current/stemming-in-situ.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/stemming-in-situ.html) with respect to relevance?

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [September 1, 2016, 8:32pm UTC](https://discuss.elastic.co/t/exact-match-for-a-string-in-elastic-search/59587/4 "2016-09-01T20:32:18Z")

</div>

That stemming-in-situ thing is what you are looking for, I think. It doesn't make an extra field like you want so the index'll be smaller. The way I proposed will make a larger index but it'll let you put more weight on exact matches which is nice, but maybe not what you need. If you have time it is worth playing with both options and seeing how the results look.

---

<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/exact-match-for-a-string-in-elastic-search/59587/5 "2017-07-05T22:23:07Z")

</div>


