Continue to section 10
3), match【match query】
- Basic type (non-string), exact match
match returns data with account_number=20:
GET /bank/_search
{
"query": {
"match": {
"account_number": 20
}
}
}
- String, full text search
Finally, all records containing the word Kings in the address are searched out. When searching for the string type, a full-text search will be performed, and each record has a relevance score.
GET /bank/_search
{
"query": {
"match": {
"address": "Kings"
}
}
}
- String, multiple words (word segmentation + full text search)
Full text search is sorted according to the score, and the search conditions will be segmented and matched
GET /bank/_search
{
"query": {
"match": {
"address": "Mill Lane"
}
}
}
Finally, query all the records that contain Mill or Lane or Mill Lane in the address, and give the relevance score
reference:
Getting started with the full-text search engine Elasticsearch