Hello All 

I am quite new for elasticsearch and reading elasticsearch related 
documents from few days. I am creating a contact list search for my 
application, where contacts are stored in <lastname (nickname), 
firstname> format. 

I am facing a problem while searching the name using java client. 

for example few contacts in my application are: 

Smith (Mik), Mike 
Smith, John 
Gomes, Madona 
Fernandis, Madona 
Trav (Mik), John 

Now, when I search the name with java client api, the search term split in 
tokens and return wrong results: 

Case 1: 
QueryBuilder qb = QueryBuilders.queryString("John Gomes*"); 
Expected Result: 0 
Actual Result: "Smith, John", "Gomes, Madona" and "Trav (Mik), John" 

Case 2: 
QueryBuilder qb = QueryBuilders.queryString("Smi* John"); 
Expected Result: "Smith, John" 
Actual Result: "Smith, John" , "Smith (Mik), Mike" and "Trav (Mik), John" 

Case 3: 
QueryBuilder qb = QueryBuilders.queryString("Gomes Madona"); 
Expected Result: "Gomes, Madona" 
Actual Result: "Gomes, Madona" and "Fernandis, Madona" 


This is heppening because search term split into two tokens and it's 
searching in result for 2 separate words. 

I tried with "not_analyzed" in mapping for name field but it restricted me 
to search case sensitive and in record stored order only, but as per my 
usecase user can search with any order in name. In case of two or more 
words query I need to display exact results and in case of one word query I 
have to display results containing search term. 

Please suggest how to get expected results. What config changes I need to 
do to get correct results. 

Thanks in advance. 

Regards, 
Omi 

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/421b5e94-199a-4d4d-8b58-5ae650f53cb4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to