elasticsearch + mappings + filed type

1. 參考

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html

2. 字符串類型

  • text
  • keyword

3. 數值類型

  • long
  • integer
  • short
  • byte
  • double
  • float
  • half_float
  • scaled_float

4. 日期類型

  • date

5. 布爾值類型

  • boolean

6. 二進制類型

  • binary

7. 範圍類型

  • integer_range
  • float_range
  • long_range
  • double_range
  • date_range

8. Array 數據類型

Array 不需要定義特殊類型

9. Object 數據類型

json 嵌套

10. 地理數據類型

  • Geo-point
  • Geo-Shape

11. 特殊數據類型

  • ip(IPv4 and IPv6 addresses)
  • completion(自動完成/搜索)
  • token_count (數值類型,分析字符串,索引的數量)
  • murmur3 (索引時計算字段值的散列並將它們存儲在索引中的功能。 在高基數和大字符串字段上運行基數聚合時有很大幫助)
  • join (同一索引的文檔中創建父/子關係)

12. 以下是常用的參數類型定義&賦值 demo

類型 參數定義 賦值
text "name":{"type":"text"} "name": "zhangsan"
keyword "tags":{"type":"keyword"} "tags": "abc"
date "date":{"type": "date"} "date":"2015-01-01T12:10:30Z"
long "age":{"type":"long"} "age" :28
double "score":{"type":"double"} "score":98.8
boolean "isgirl": { "type": "boolean" } "isgirl" :true
ip "ip_addr":{"type":"ip"} "ip_addr": "192.168.1.1"
geo_point "location": {"type":"geo_point"} "location":{"lat":40.12,"lon":-71.34}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章