国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 操作系統 > 正文

Elasticsearch學習筆記:multi-fields

2024-06-28 16:01:49
字體:
來源:轉載
供稿:網友

multi-fields

It is often useful to index the same field in different ways for different purposes. This is the purpose of multi-fields. For instance, a string field could be mapped as a text field for full-text search, and as a keyWord field for sorting or aggregations. You can define as many fields with the fields parameter as you want. Please note that this option is only available for core data types and not for the objects.

對一個field設置多種索引方式。比如,一個字符串設置為”text”類型用于進行全文檢索,同時又給它設置”keyword”類型用于排序或聚合。

#對需要設置的字段,在'type'屬性后增加"fields": #其中的"raw"為自定義的名稱,想象它是city的一個分身。PUT /my_index{ "mappings": { "my_type": { "PRoperties": { "city": { "type": "text", "fields": { "raw": { "type": "keyword" } } } } } }}

插入數據

PUT /my_index/my_type/1{ "city": "New York"}PUT /my_index/my_type/2{ "city": "York"}

查詢并排序 查詢字段為city,使用它的text類型.排序使用了city.raw

GET /my_index/_search{ "query": { "match": { "city": "York" } }, "sort": { "city.raw": "asc" }}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 民勤县| 金塔县| 卢龙县| 新乡市| 乌拉特后旗| 汾西县| 织金县| 阳泉市| 忻城县| 壶关县| 芦山县| 永顺县| 邵阳县| 招远市| 依安县| 黄龙县| 辽阳市| 秭归县| 资阳市| 来宾市| 河间市| 南丹县| 苗栗县| 广丰县| 阿拉善盟| 洛隆县| 如皋市| 潞城市| 霍州市| 鄱阳县| 裕民县| 普格县| 腾冲县| 公主岭市| 钦州市| 辽宁省| 开江县| 全椒县| 玛沁县| 五原县| 永清县|