Last active
April 9, 2016 18:39
-
-
Save ttezel/6143316 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 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
result of the search: