Skip to content

Instantly share code, notes, and snippets.

@ivanionut
Forked from ttezel/gist:6143316
Created April 9, 2016 18:39
Show Gist options
  • Save ivanionut/14fe0d06e427d5d5aa6ec46b2d93942a to your computer and use it in GitHub Desktop.
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
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