Elasticsearch7.*字段數據類型


本文 Elasticsearch 版本為 7.2

主要數據類型

(1)字符串類型: text, keyword

(2)數字類型:longintegershortbytedoublefloathalf_floatscaled_float

(3)日期:date

(4)日期 納秒:date_nanos

(5)布爾型:boolean

(6)Binary:binary

(7)Range: integer_rangefloat_rangelong_rangedouble_rangedate_range

復雜數據類型

(1)Object: object(單個JSON對象)

(2)Nested: nested (JSON對象數組)

 地理數據類型

(1)Geo-point: geo_point (緯度/經度積分)

(2)Geo-shape: geo_shape (用於多邊形等復雜形狀)

特殊數據類型

(1)IP:  ip (IPv4 和 IPv6 地址)

(2)Completion類型:completion (to provide auto-complete suggestions)

(3)Token count:token_count (to count the number of tokens in a string)

(4)mapper-murmur3:murmur3(to compute hashes of values at index-time and store them in the index)

(5)mapper-annotated-text:annotated-text (to index text containing special markup (typically used for identifying named entities))

(6)Percolator:(Accepts queries from the query-dsl)

(7)Join:(Defines parent/child relation for documents within the same index)

(8)Alias:(Defines an alias to an existing field.)

(9)Rank feature:(Record numeric feature to boost hits at query time.)

(10)Rank features:(Record numeric features to boost hits at query time.)

(11)Dense vector:(Record dense vectors of float values.)

(12)Sparse vector:(Record sparse vectors of float values.)

(13)Search-as-you-type:(A text-like field optimized for queries to implement as-you-type completion)

數組類型

        在Elasticsearch中,數組不需要一個特定的數據類型,任何字段都默認可以包含一個或多個值,當然,這多個值都必須是字段指定的數據類型。

Multi-fields

        Multi-fields 通常用來以不同的方式或目的索引同一個字段。比如,一個字符串類型字段可以同時被映射為 text 類型以用於全文檢索、 keyword字段用於排序或聚合。又或者,你可以用standard分析器、english分析器和french分析器來索引同一個 text字段。  

 

  為不同的目的以不同的方式對同一字段建立索引通常很有用。例如,一個string字段可以映射為text用於全文搜索的字段,也可以映射為keyword用於排序或聚合的字段.大多數數據類型通過fields參數支持多字段。

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

牛人博客:https://juejin.im/post/6844903661722664973


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM