Is there a way to do exact and full text searches without having to create 
two different fields?

The documentation 
(http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/_finding_exact_values.html)
 
states fields must have the mapping "not_analyzed" in order to avoid 
tokenization. This allows exact searches to be done.

In my case, I would like both full text search and exact searches. For 
example:

When searching for book titles, a user can input either:

I like ElasticSearch

-OR-

exact="I like ElasticSearch"

The first case will return results from a full text search. 

The second case will return results only if the book title is exactly "I 
like ElasticSearch". Case sensitivity does not matter.

To do this, I think I will have to create two fields called "book_title" 
and "book_title_exact" where "book_title_exact" will have a field mapping 
"not_analyzed" so that I can do exact matches.

Is this the proper way of handling my use case? Or is there a simpler way 
in ES without having to store a title twice?

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/ac298481-b0f0-4052-a115-388e9db92f50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to