Created
July 24, 2012 16:12
-
-
Save alfetopito/3170949 to your computer and use it in GitHub Desktop.
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
# using fuzzy_like_this_field query | |
curl -XGET 'http://localhost:9200/tokens/pt_BR/_search?pretty=true' -d ' | |
{ | |
"query": { | |
"fuzzy_like_this_field": { | |
"pt_BR.keyword": { | |
"like_text": "cartões bradesco", | |
"prefix_length": 1, | |
"min_similarity": 0.7 | |
} | |
} | |
} | |
}' | |
{ | |
"took" : 5, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 173, | |
"max_score" : 9.866068, | |
"hits" : [ { | |
"_index" : "tokens", | |
"_type" : "pt_BR", | |
"_id" : "9BPM7KOjT_mRBasFjjP5IQ", | |
"_score" : 9.866068, "_source" : {"keyword": "bradesco cartoes"} | |
}, { | |
"_index" : "tokens", | |
"_type" : "pt_BR", | |
"_id" : "XnyJeCZfSfuHbB1AOAFprA", | |
"_score" : 7.04796, "_source" : {"keyword": "bradesco cartoes de credito"} | |
}, { | |
"_index" : "tokens", | |
"_type" : "pt_BR", | |
"_id" : "paznUQaXSzOkVjBTlADW9w", | |
"_score" : 7.0471916, "_source" : {"keyword": "bradesco cartoes fatura"} | |
}, { | |
"_index" : "tokens", | |
"_type" : "pt_BR", | |
"_id" : "JPwjUT6-TiSDL9C_OlLRfA", | |
"_score" : 7.019065, "_source" : {"keyword": "bradesco cartoes fidelidade"} | |
}, { | |
"_index" : "tokens", | |
"_type" : "pt_BR", | |
"_id" : "6FmQZtrwTtGhGW8hrWQEFg", | |
"_score" : 2.5428944, "_source" : {"keyword": "itau cartoes"} | |
}, { | |
"_index" : "tokens", | |
"_type" : "pt_BR", | |
"_id" : "vYqRhek_SHecvXN47M34gA", | |
"_score" : 2.5005953, "_source" : {"keyword": "bradesco consorcios"} | |
}, { | |
"_index" : "tokens", | |
"_type" : "pt_BR", | |
"_id" : "xVWVmn7pRm-6oYakPh8AhQ", | |
"_score" : 2.442063, "_source" : {"keyword": "teatro bradesco"} | |
}, { | |
"_index" : "tokens", | |
"_type" : "pt_BR", | |
"_id" : "WQcCMS8rTVelT6ZBgPBTjw", | |
"_score" : 2.442063, "_source" : {"keyword": "convenio bradesco"} | |
}, { | |
"_index" : "tokens", | |
"_type" : "pt_BR", | |
"_id" : "d9QS9-PLRP-5UcGOxQbyjg", | |
"_score" : 2.442063, "_source" : {"keyword": "bradesco dental"} | |
}, { | |
"_index" : "tokens", | |
"_type" : "pt_BR", | |
"_id" : "NVfa8ENQRNy8lylFcrWq8g", | |
"_score" : 2.4244142, "_source" : {"keyword": "cartoes de pascoa"} | |
} ] | |
} | |
} | |
# using boolean text query | |
curl -XPOST 'http://localhost:9200/tokens/pt_BR/_search?pretty=true' -d ' | |
{ | |
"query": { | |
"text": { | |
"keyword": { | |
"query": "cartões bradesco", | |
"fuzziness": 0.7, | |
"operator": "and", | |
"prefix_length": 1 | |
} | |
} | |
} | |
}' | |
{ | |
"took" : 4, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 4, | |
"max_score" : 75.17585, | |
"hits" : [ { | |
"_index" : "tokens", | |
"_type" : "pt_BR", | |
"_id" : "9BPM7KOjT_mRBasFjjP5IQ", | |
"_score" : 75.17585, "_source" : {"keyword": "bradesco cartoes"} | |
}, { | |
"_index" : "tokens", | |
"_type" : "pt_BR", | |
"_id" : "XnyJeCZfSfuHbB1AOAFprA", | |
"_score" : 56.032196, "_source" : {"keyword": "bradesco cartoes de credito"} | |
}, { | |
"_index" : "tokens", | |
"_type" : "pt_BR", | |
"_id" : "paznUQaXSzOkVjBTlADW9w", | |
"_score" : 53.697037, "_source" : {"keyword": "bradesco cartoes fatura"} | |
}, { | |
"_index" : "tokens", | |
"_type" : "pt_BR", | |
"_id" : "JPwjUT6-TiSDL9C_OlLRfA", | |
"_score" : 53.28247, "_source" : {"keyword": "bradesco cartoes fidelidade"} | |
} ] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment