Exact match or phrase match without enabling term vector

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 ?

You can index a field also as a keyword type using multi-field. 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 option.

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

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?

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

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

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 based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents. Elasticsearch is developed in Java.

Doc-2 Text

Elasticsearch is a search engine.Shay Banon created the precursor to Elasticsearch, called Compass, in 2004.[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] So he created "a solution built from the ground up to be distributed" and used a common interface, JSON over 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.

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

For phrase search, have you tried match_phrase query?

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