Last active
August 29, 2015 14:03
-
-
Save yinchunxiang/57c376d65217a242c274 to your computer and use it in GitHub Desktop.
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
# match | |
curl -XPOST --user superuser:Adm1n 'http://localhost:9200/estest/table1/_search?pretty' -d ' | |
{ | |
"query" : { | |
"match" : { | |
"sex" : "term1 term2" | |
} | |
} | |
}' | |
# match phrase | |
curl -XPOST --user superuser:Adm1n 'http://localhost:9200/estest/table1/_search?pretty' -d ' | |
{ | |
"query" : { | |
"match_phrase" : { | |
"sex" : "term1 term2" | |
} | |
} | |
}' | |
curl -XPOST --user superuser:Adm1n 'http://localhost:9200/estest/table1/_search?pretty' -d ' | |
{ | |
"query" : { | |
"match" : { | |
"sex" : "term1 term2" | |
"type": "phrase" | |
} | |
} | |
}' | |
# match_phrase_prefix | |
curl -XPOST --user superuser:Adm1n 'http://localhost:9200/estest/table1/_search?pretty' -d ' | |
{ | |
"query" : { | |
"match_phrase_prefix" : { | |
"sex" : "term1 ter" | |
} | |
} | |
}' | |
curl -XPOST --user superuser:Adm1n 'http://localhost:9200/estest/table1/_search?pretty' -d ' | |
{ | |
"query" : { | |
"match" : { | |
"sex" : "term1 ter" | |
"type": "phrase_prefix" | |
} | |
} | |
}' | |
# specify analyzer and max_expansions | |
curl -XPOST --user superuser:Adm1n 'http://localhost:9200/estest/table1/_search?pretty' -d ' | |
{ | |
"query" : { | |
"match" : { | |
"sex" : "term1 ter", | |
"type": "phrase_prefix", | |
"analyzer": "my_analyzer", | |
# max_expansions parameter that can control to how many prefixes the last term will be expanded. | |
# It is highly recommended to set it to an acceptable value to control the execution time of the query. | |
"max_expansions": 10 | |
} | |
} | |
}' | |
# return only part fields | |
"_source": ["account_number", "balance"] | |
# specify return records number | |
"size" : 10 | |
# specify return records start_number | |
"from" : 5 | |
# multi match | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment