Created
September 16, 2021 17:40
-
-
Save andreaschiffo/bf5ebeac1d6875a1a78dbb9e2eb8e19b to your computer and use it in GitHub Desktop.
ES query for matching accounts not working
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
{ | |
"from":0, | |
"size":100, | |
"explain": true, | |
"query":{ | |
"dis_max":{ | |
"tie_breaker":0.5, | |
"queries":[ | |
{ | |
"fuzzy":{ | |
"username":{ | |
"value":"xxx", | |
"fuzziness":"AUTO", | |
"prefix_length":0, | |
"max_expansions":50, | |
"transpositions":false, | |
"boost":2.0 | |
} | |
} | |
}, | |
{ | |
"term":{ | |
"email":{ | |
"value":"gmail.com", | |
"boost":1.0 | |
} | |
} | |
}, | |
{ | |
"fuzzy":{ | |
"email":{ | |
"value":"xxx", | |
"fuzziness":"AUTO", | |
"prefix_length":0, | |
"max_expansions":50, | |
"transpositions":false, | |
"boost":1.0 | |
} | |
} | |
}, | |
{ | |
"term":{ | |
"password-hash":{ | |
"value":"xxx", | |
"boost":1.0 | |
} | |
} | |
}, | |
{ | |
"term":{ | |
"currency-code":{ | |
"value":"xxx", | |
"boost":0.5 | |
} | |
} | |
}, | |
{ | |
"match":{ | |
"first-name":{ | |
"query":"xxx", | |
"operator":"OR", | |
"prefix_length":0, | |
"max_expansions":50, | |
"fuzzy_transpositions":true, | |
"lenient":false, | |
"zero_terms_query":"NONE", | |
"auto_generate_synonyms_phrase_query":true, | |
"boost":1.0 | |
} | |
} | |
}, | |
{ | |
"match":{ | |
"last-name":{ | |
"query":"xxx", | |
"operator":"OR", | |
"prefix_length":0, | |
"max_expansions":50, | |
"fuzzy_transpositions":true, | |
"lenient":false, | |
"zero_terms_query":"NONE", | |
"auto_generate_synonyms_phrase_query":true, | |
"boost":1.0 | |
} | |
} | |
}, | |
{ | |
"dis_max":{ | |
"queries":[ | |
{ | |
"match":{ | |
"first-name":{ | |
"query":"xxx", | |
"operator":"OR", | |
"prefix_length":0, | |
"max_expansions":50, | |
"fuzzy_transpositions":true, | |
"lenient":false, | |
"zero_terms_query":"NONE", | |
"auto_generate_synonyms_phrase_query":true, | |
"boost":1.0 | |
} | |
} | |
}, | |
{ | |
"match":{ | |
"last-name":{ | |
"query":"xxx", | |
"operator":"OR", | |
"prefix_length":0, | |
"max_expansions":50, | |
"fuzzy_transpositions":true, | |
"lenient":false, | |
"zero_terms_query":"NONE", | |
"auto_generate_synonyms_phrase_query":true, | |
"boost":1.0 | |
} | |
} | |
} | |
], | |
"boost":1.1 | |
} | |
}, | |
{ | |
"match":{ | |
"date-of-birth":{ | |
"query":"xxxx-xx-xx", | |
"operator":"OR", | |
"prefix_length":0, | |
"max_expansions":50, | |
"fuzzy_transpositions":true, | |
"lenient":false, | |
"zero_terms_query":"NONE", | |
"auto_generate_synonyms_phrase_query":true, | |
"boost":1.0 | |
} | |
} | |
}, | |
{ | |
"bool":{ | |
"must":[ | |
{ | |
"fuzzy" : { | |
"first-name" : { | |
"value" : "xxx", | |
"fuzziness" : "AUTO", | |
"prefix_length" : 0, | |
"max_expansions" : 50, | |
"transpositions" : true, | |
"boost" : 1.5 | |
} | |
} | |
}, | |
{ | |
"fuzzy" : { | |
"last-name" : { | |
"value" : "xxx", | |
"fuzziness" : "AUTO", | |
"prefix_length" : 0, | |
"max_expansions" : 50, | |
"transpositions" : true, | |
"boost" : 1.5 | |
} | |
} | |
}, | |
{ | |
"match":{ | |
"date-of-birth":{ | |
"query":"xxxx-xx-xx", | |
"operator":"OR", | |
"prefix_length":0, | |
"max_expansions":50, | |
"fuzzy_transpositions":true, | |
"lenient":false, | |
"zero_terms_query":"NONE", | |
"auto_generate_synonyms_phrase_query":true, | |
"boost":1.0 | |
} | |
} | |
} | |
], | |
"adjust_pure_negative":true, | |
"boost":3.0 | |
} | |
}, | |
{ | |
"match":{ | |
"address":{ | |
"query":"xxx", | |
"operator":"OR", | |
"analyzer":"whitespace", | |
"fuzziness":"AUTO", | |
"prefix_length":0, | |
"max_expansions":50, | |
"minimum_should_match":"60%", | |
"fuzzy_transpositions":true, | |
"lenient":false, | |
"zero_terms_query":"NONE", | |
"auto_generate_synonyms_phrase_query":true, | |
"boost":1.1 | |
} | |
} | |
}, | |
{ | |
"match":{ | |
"city":{ | |
"query":"xxx", | |
"operator":"OR", | |
"prefix_length":0, | |
"max_expansions":50, | |
"fuzzy_transpositions":true, | |
"lenient":false, | |
"zero_terms_query":"NONE", | |
"auto_generate_synonyms_phrase_query":true, | |
"boost":1.0 | |
} | |
} | |
}, | |
{ | |
"term":{ | |
"postal-code":{ | |
"value":"xxx ", | |
"boost":1.5 | |
} | |
} | |
}, | |
{ | |
"boosting":{ | |
"positive":{ | |
"match":{ | |
"address":{ | |
"query":"xxx", | |
"operator":"OR", | |
"analyzer":"whitespace", | |
"fuzziness":"AUTO", | |
"prefix_length":0, | |
"max_expansions":50, | |
"minimum_should_match":"60%", | |
"fuzzy_transpositions":true, | |
"lenient":false, | |
"zero_terms_query":"NONE", | |
"auto_generate_synonyms_phrase_query":true, | |
"boost":1.1 | |
} | |
} | |
}, | |
"negative":{ | |
"bool":{ | |
"must_not":[ | |
{ | |
"term":{ | |
"postal-code":{ | |
"value":"xxx ", | |
"boost":1.5 | |
} | |
} | |
} | |
], | |
"adjust_pure_negative":true, | |
"boost":1.0 | |
} | |
}, | |
"negative_boost":0.7, | |
"boost":1.0 | |
} | |
}, | |
{ | |
"term":{ | |
"country-code":{ | |
"value":"xxx", | |
"boost":1.0 | |
} | |
} | |
}, | |
{ | |
"match":{ | |
"phone":{ | |
"query":"xxx", | |
"operator":"OR", | |
"prefix_length":0, | |
"max_expansions":50, | |
"fuzzy_transpositions":true, | |
"lenient":false, | |
"zero_terms_query":"NONE", | |
"auto_generate_synonyms_phrase_query":true, | |
"boost":2.0 | |
} | |
} | |
}, | |
{ | |
"match":{ | |
"security-question":{ | |
"query":"xxx?", | |
"operator":"OR", | |
"prefix_length":0, | |
"max_expansions":50, | |
"fuzzy_transpositions":true, | |
"lenient":false, | |
"zero_terms_query":"NONE", | |
"auto_generate_synonyms_phrase_query":true, | |
"boost":1.0 | |
} | |
} | |
}, | |
{ | |
"match":{ | |
"security-answer":{ | |
"query":"xxx ", | |
"operator":"OR", | |
"prefix_length":0, | |
"max_expansions":50, | |
"fuzzy_transpositions":true, | |
"lenient":false, | |
"zero_terms_query":"NONE", | |
"auto_generate_synonyms_phrase_query":true, | |
"boost":1.0 | |
} | |
} | |
} | |
], | |
"boost":1.0 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment