# Exact match or phrase match without enabling term vector

**URL:** <https://discuss.elastic.co/t/exact-match-or-phrase-match-without-enabling-term-vector/222488>\
**Category:** Elasticsearch\
**Created:** [March 6, 2020, 4:23pm UTC](https://discuss.elastic.co/t/exact-match-or-phrase-match-without-enabling-term-vector/222488 "2020-03-06T16:23:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ajay\_Singhal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ajay_singhal/32/45433_2.png) [@Ajay\_Singhal](https://discuss.elastic.co/u/Ajay_Singhal)\
**Post date:** [March 6, 2020, 4:23pm UTC](https://discuss.elastic.co/t/exact-match-or-phrase-match-without-enabling-term-vector/222488/1 "2020-03-06T16:23:18Z")

</div>

I am facing issues in exact match. I am using standard analyzer but exact match is not working with this. If I enable term vector then it is working but enabling term vector is increasing size of elastic index.

Can you please help me with another way of exact match to get rid of big index size ?

---

<div class="post-metadata">

**Author:** ![mayya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mayya/32/83147_2.png) [@mayya](https://discuss.elastic.co/u/mayya)\
**Post date:** [March 9, 2020, 1:28pm UTC](https://discuss.elastic.co/t/exact-match-or-phrase-match-without-enabling-term-vector/222488/2 "2020-03-09T13:28:21Z")

</div>

You can index a field also as a `keyword` type using [multi-field](https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html). Searching on a `keyword` type is based on exact matching.  
If some of your field values are very long, you can skip indexing them using [ignore\_above](https://www.elastic.co/guide/en/elasticsearch/reference/current/ignore-above.html) option.

---

<div class="post-metadata">

**Author:** ![Ajay\_Singhal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ajay_singhal/32/45433_2.png) [@Ajay\_Singhal](https://discuss.elastic.co/u/Ajay_Singhal)\
**Post date:** [March 11, 2020, 4:05am UTC](https://discuss.elastic.co/t/exact-match-or-phrase-match-without-enabling-term-vector/222488/3 "2020-03-11T04:05:19Z")

</div>

I have a document long text and searching from that text. Can I take that text as keyword ?

---

<div class="post-metadata">

**Author:** ![mayya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mayya/32/83147_2.png) [@mayya](https://discuss.elastic.co/u/mayya)\
**Post date:** [March 11, 2020, 8:57pm UTC](https://discuss.elastic.co/t/exact-match-or-phrase-match-without-enabling-term-vector/222488/4 "2020-03-11T20:57:35Z")

</div>

When you say "exact match" on a long text, are you expecting to search for the exact match on this whole long text?  
How long is your text?

---

<div class="post-metadata">

**Author:** ![Ajay\_Singhal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ajay_singhal/32/45433_2.png) [@Ajay\_Singhal](https://discuss.elastic.co/u/Ajay_Singhal)\
**Post date:** [March 12, 2020, 3:54am UTC](https://discuss.elastic.co/t/exact-match-or-phrase-match-without-enabling-term-vector/222488/5 "2020-03-12T03:54:11Z")

</div>

There is no limit of text in our documents. It can be 50k words or more.

---

<div class="post-metadata">

**Author:** ![mayya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mayya/32/83147_2.png) [@mayya](https://discuss.elastic.co/u/mayya)\
**Post date:** [March 16, 2020, 1:08pm UTC](https://discuss.elastic.co/t/exact-match-or-phrase-match-without-enabling-term-vector/222488/6 "2020-03-16T13:08:32Z")

</div>

Your task is still not clear for me. Are you expecting users to enter the exact 50K words string for a search?

---

<div class="post-metadata">

**Author:** ![Ajay\_Singhal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ajay_singhal/32/45433_2.png) [@Ajay\_Singhal](https://discuss.elastic.co/u/Ajay_Singhal)\
**Post date:** [March 17, 2020, 4:45am UTC](https://discuss.elastic.co/t/exact-match-or-phrase-match-without-enabling-term-vector/222488/7 "2020-03-17T04:45:58Z")

</div>

Hi Maya,

We have several documents which have no word limit. It can have any no. of words. We indexed these document text and stored in elastic index. Now we want to find only the documents which have exact match of search string.

For example we have two documents.

**Doc-1 Text**

**Elasticsearch** is a [search engine](https://en.wikipedia.org/wiki/Search_engine_(computing)) based on the [Lucene](https://en.wikipedia.org/wiki/Lucene) library. It provides a distributed, [multitenant](https://en.wikipedia.org/wiki/Multitenancy)-capable [full-text search](https://en.wikipedia.org/wiki/Full-text_search) engine with an [HTTP](https://en.wikipedia.org/wiki/HTTP) web interface and schema-free [JSON](https://en.wikipedia.org/wiki/JSON) documents. Elasticsearch is developed in [Java](https://en.wikipedia.org/wiki/Java_(programming_language)).

**Doc-2 Text**

**Elasticsearch** is a [search engine](https://en.wikipedia.org/wiki/Search_engine_(computing)).Shay Banon created the precursor to Elasticsearch, called Compass, in 2004.[[6]](https://en.wikipedia.org/wiki/Elasticsearch#cite_note-compass-6) While thinking about the third version of Compass he realized that it would be necessary to rewrite big parts of Compass to "create a scalable search solution".[[6]](https://en.wikipedia.org/wiki/Elasticsearch#cite_note-compass-6) So he created "a solution built from the ground up to be distributed" and used a common interface, [JSON](https://en.wikipedia.org/wiki/JSON) over [HTTP](https://en.wikipedia.org/wiki/HTTP), suitable for programming languages other than Java as well.

Suppose we searched for string "Java" then it should return both document that is working in my case but if I search for "Java as well" than it is also returning both the documents. In this case it should return the second document in **phrase match**.

In this case If I enables the term vector than it is working but enabling term vector increasing the index size so I want to know any alternate method to do this thing because we have a lot of documents which have a lot of text.

Let me know if it is still not clear to you.

---

<div class="post-metadata">

**Author:** ![mayya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mayya/32/83147_2.png) [@mayya](https://discuss.elastic.co/u/mayya)\
**Post date:** [March 18, 2020, 4:32pm UTC](https://discuss.elastic.co/t/exact-match-or-phrase-match-without-enabling-term-vector/222488/8 "2020-03-18T16:32:49Z")

</div>

Thank you for explanation, your task is clear to me.

For phrase search, have you tried [match\_phrase](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase.html) 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:** [April 15, 2020, 4:32pm UTC](https://discuss.elastic.co/t/exact-match-or-phrase-match-without-enabling-term-vector/222488/9 "2020-04-15T16:32:59Z")

</div>

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