對視頻播放網站做性能測試查排名的軟件有哪些
一、題目
為一個索引,按要求設置以下 dynamic Mapping
- 一切 text 類型的字段,類型全部映射成 keyword
- 一切以 int_ 開頭命名的字段,類型都設置成 integer
1.1 考點
字段的動態(tài)映射
1.2 答案
# 創(chuàng)建索引和索引模板
PUT my_index
{"mappings": {"dynamic_templates": [{"integer": {"match": "int_*","mapping": {"type": "integer"}}},{"text": {"match_mapping_type": "string","mapping": {"type": "keyword"}}}]}
}# 寫入數據
POST my_index/_bulk
{"index":{}}
{"text":"天安門廣場", "int_value":23}
{"index":{}}
{"cont":"好看的小說", "int_value":50.0}
{"index":{}}
{"cont":"晚上值班很痛苦", "int_value":88.8}檢查索引結構
GET my_index/_mapping
二、題目
為 movies 索引設定一個別名,默認查詢只返回 score 字段 大于 3 的電影
# 創(chuàng)建索引
PUT movies
{"mappings": {"properties": {"name": {"type": "keyword"},"score": {"type": "float"}}}
}# 寫入數據
POST movies/_bulk
{"index":{}}
{"name":"百萬雄師過大江","score":5}
{"index":{}}
{"name":"陸小鳳傳奇","score":4}
{"index":{}}
{"name":"七宗罪","score":3}
{"index":{}}
{"name":"華爾街之狼","score":2.1}
1.1 考點
- 索引別名
1.2 答案
# 建立別名
POST _aliases
{"actions": [{"add": {"index": "movies","alias": "movies_alias","filter": {"bool": {"filter": [{"range": {"score": {"gte": 3}}}]}}}}]
}# 用別名檢索
GET movies_alias/_search