版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_42528266/article/details/102799417
{
"mappings": {
"properties": {
"name": {
"type": "text"
},
"team_name": {
"type": "text"
},
"position": {
"type": "text"
},
"play_year": {
"type": "long"
},
"jerse_no": {
"type": "keyword"
}
}
}
}
{
"name": "哈登",
"team_name": "⽕箭",
"position": "得分后卫",
"play_year": 10,
"jerse_no": "13"
}
{
"name": "库⾥",
"team_name": "勇⼠",
"position": "控球后卫",
"play_year": 10,
"jerse_no": "30"
}
{
"name": "詹姆斯",
"team_name": "湖⼈",
"position": "⼩前锋",
"play_year": 15,
"jerse_no": "23"
}
{
"query": {
"term": {
"jerse_no": "23"
}
}
}
{
"query": {
"terms": {
"jerse_no": [
"23",
"13"
]
}
}
}
{
"took": 21,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 2,
"relation": "eq"
},
"max_score": 1,
"hits": [{
"_index": "nba",
"_type": "_doc",
"_id": "1",
"_score": 1,
"_source": {
"name": "哈登",
"team_name": "⽕箭",
"position": "得分后卫",
"play_year": 10,
"jerse_no": "13"
}
},
{
"_index": "nba",
"_type": "_doc",
"_id": "3",
"_score": 1,
"_source": {
"name": "詹姆斯",
"team_name": "湖⼈",
"position": "⼩前锋",
"play_year": 15,
"jerse_no": "23"
}
}
]
}
}
{
"query": {
"match_all": {}
},
"from": 0,
"size": 10
}
{
"took": 9,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 3,
"relation": "eq"
},
"max_score": 1,
"hits": [{
"_index": "nba",
"_type": "_doc",
"_id": "1",
"_score": 1,
"_source": {
"name": "哈登",
"team_name": "⽕箭",
"position": "得分后卫",
"play_year": 10,
"jerse_no": "13"
}
},
{
"_index": "nba",
"_type": "_doc",
"_id": "2",
"_score": 1,
"_source": {
"name": "库⾥",
"team_name": "勇⼠",
"position": "控球后卫",
"play_year": 10,
"jerse_no": "30"
}
},
{
"_index": "nba",
"_type": "_doc",
"_id": "3",
"_score": 1,
"_source": {
"name": "詹姆斯",
"team_name": "湖⼈",
"position": "⼩前锋",
"play_year": 15,
"jerse_no": "23"
}
}
]
}
}
{
"query": {
"match": {
"position": "后卫"
}
}
}
{
"took": 89,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 2,
"relation": "eq"
},
"max_score": 0.90630186,
"hits": [{
"_index": "nba",
"_type": "_doc",
"_id": "1",
"_score": 0.90630186,
"_source": {
"name": "哈登",
"team_name": "⽕箭",
"position": "得分后卫",
"play_year": 10,
"jerse_no": "13"
}
},
{
"_index": "nba",
"_type": "_doc",
"_id": "2",
"_score": 0.90630186,
"_source": {
"name": "库⾥",
"team_name": "勇⼠",
"position": "控球后卫",
"play_year": 10,
"jerse_no": "30"
}
}
]
}
}
{
"doc": {
"name": "库⾥",
"team_name": "勇⼠",
"position": "控球后卫",
"play_year": 10,
"jerse_no": "30",
"title": "the best shooter"
}
}
{
"query": {
"multi_match": {
"query": "shooter",
"fields": ["title", "name"]
}
}
}
{
"query": {
"multi_match": {
"query": "shooter",
"fields": ["*title", "name"]
}
}
}
{
"query": {
"match_phrase": {
"position": "得分后卫"
}
}
}
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 3.0384295,
"hits": [{
"_index": "nba",
"_type": "_doc",
"_id": "1",
"_score": 3.0384295,
"_source": {
"name": "哈登",
"team_name": "⽕箭",
"position": "得分后卫",
"play_year": 10,
"jerse_no": "13"
}
}]
}
}
{
"doc": {
"name": "詹姆斯",
"team_name": "湖⼈",
"position": "⼩前锋",
"play_year": 15,
"jerse_no": "23",
"title": "the best small forward"
}
}
{
"query": {
"match_phrase_prefix": {
"title": "the best s"
}
}
}