Search code examples
elasticsearchfuzzy-search

Elastic Search fuzzy search not finding desired results


In elastic search index i have trademark data.I have trademarks named HILTON in database, but when i search hillytown its not finding hilton, but when searched hilytown it finds. How can i modify elsatic search to find hilton when i search hillytown

note: : hillytown has two l

The search that i tried is

$param = '
       {
        "query": {
        "fuzzy" : {
            "trademark" : {
                "value": "'.$keyword.'",
                "boost": 1.0,
                "fuzziness": "AUTO",
                "prefix_length": 0,
                "max_expansions": 100,
                "transpositions":true
            }
        }
      }
      }';

in

http://localhost:9200/watch_index_write/_search

Solution

  • I don't think you can get "hillytown" to match "hilton". Elasticsearch allows a maximum fuzziness (levenshtein distance) of 2, but hillytown has a distance of 3 (need to remove 3 letters).

    I haven't tried it myself, but the phonetic analysis plugin might provide a way forward.