-
-
Save ivanionut/14fe0d06e427d5d5aa6ec46b2d93942a to your computer and use it in GitHub Desktop.
Elasticsearch fuzzy search scores the same for exact match and non-exact match
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPOST 'http://localhost:9200/fuzzytest/' -d ' | |
{ | |
settings: { | |
index: { | |
analysis: { | |
analyzer: { | |
default: { | |
type: "custom", | |
tokenizer: "uax_url_email", | |
filter: [ "lowercase" ] | |
} | |
} | |
} | |
} | |
} | |
}' | |
curl -XPOST 'http://localhost:9200/fuzzytest/product' -d ' | |
{ | |
text: "testphone5" | |
}' | |
curl -XPOST 'http://localhost:9200/fuzzytest/product' -d ' | |
{ | |
text: "testphone4s" | |
}' | |
curl -XPOST 'http://localhost:9200/fuzzytest/product/_search?search_type=dfs_query_then_fetch&pretty=true' -d ' | |
{ | |
"query": { | |
"fuzzy": { | |
"text": { | |
min_similarity: 0.4, | |
value: "testphone5", | |
prefix_length: 0 | |
} | |
} | |
} | |
}' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment