Question

I have two fields: first and last

I'm trying to use multi_match to fuzzy match full names:

"multi_match": {
    "query": name,
    "fields": [
        "first",
        "last",
    ],
    "fuzziness": 0.1
}

This search only matches when the search is 100% exact first +' '+ last name. This is undesirable.

What would be a more effective first-last name search technique with ElasticSearch? (assume the two fields must be separate)

e.g. typing Dan Smi should match Danny Smith

Was it helpful?

Solution

It sounds like you're looking for Phonetic Analysis, which can be used to create new tokens that represent what the original tokens sounds like.

I created a runnable example with your example data here, which shows a search for "Dan Smi" matching the first and last name fields using a double metaphone filter.

The github page of the Phonetic Analysis plugin contains the name of all the other implemented phonetic token filters that you might want to try out as well.

OTHER TIPS

Ho true, re-read your question, is more about analyzing, you can play online with analyzer/stemmer ==> http://es.subitolabs.com/#/testr/20061741

Another thing, did you look at something called "Suggestion"? Quite new, but so powerful ==> http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters.html

In a such case, I mean cross_field, you may need to do some extra work around ES, tokenize your input string before (use ES analysis API to get token pieces), then run suggester for each tokens, end re-assemble the result.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top