Currently I have around 10 million records indexed, which mainly is user
meta data like firstname and lastname with following mapping:
Field Mapping:
"user" : {"_source" : { "enabled" : true },
"properties" : {
"uniqueid" : { "type" : "string", "index" : "not_analyzed"},
"fname" : { "type" : "string", "index" : "analyzed", "analyzer"
: "standard" },
"lname" : { "type" : "string", "index" : "analyzed", "analyzer"
: "standard" }
.
.
.
}
}
I currently have a user lookup feature which lets users type in one or more
words to lookup user meta data without specifying what field is it
searching for. It is sort to Prefix search. For example user can search
for "Chris Mos" and the expected results should be in following order:
-
Chris Mos - Record that has fname as Chris and lname as Mos
-
Chris SomeLastName - Records that have fname as Chris
-
SomeFirstName Mos - Records that have lname as Mos
-
Christopher Mosby - Records henceforth should have either Chris or Mos
in prefix
I am firing following query which 95% of the time satisfies the criteria 1
but rest of the results dont necessary follow the order of criteria defined:
{explain:"false", query:{"query_string" : {"query" : "Chris* Mos*","fields"
: [ "fname ^1.5", "lname ^1.0"],"use_dis_max" : true,"analyze_wildcard" :
true}}}
Couple of problems that i am trying to solve here:
-
Relevancy - Is there a better way to query elastic search or given
the scenario should i be using different analyzer?I t -
Performance - With records growing at very fast pace, i feel that
doing wild card search isn't the best approach. Is there an alternate way
in which i can query or if i can make use of other analyzers? I tried
nGram analyzer before but the issue i was facing was that it was also
returning records which had "Chris" as mid-text. For example records with
fname as "achristy" was also returned.
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.