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

posted @ 2020-09-01 16:04  泉水姐姐。  阅读(3123)  评论(0编辑  收藏  举报