要想使用Elasticsearch,就必须掌握mapping中支持的字段类型,了解每种类型的使用场景,才能做到游刃有余。
- 核心类型
- 复合类型
- 地理类型 ( Geo )
- 特定类型
- 多字段
一 映射参数
参数说明
analyzer | 分析器应用于analyzed字符串字段,无论是在索引时间还是在搜索时间(除非被search_analyzer )。 默认为默认索引分析器或standard分析器。 |
---|---|
boost | 映射字段级查询时间提升。 接受一个浮点数,默认为1.0 。 |
coerce | 尝试将字符串转换为数字并截断整数的分数。 接受true(默认)和false。 |
eager_global_ordinals | 是否应该全新加载全局序号? true或false (默认)。 对于经常用于(重要)术语聚合的字段,启用此功能是一个好主意。 |
enabled | 是否应该为对象字段指定的JSON值进行解析和索引(true,默认)或完全忽略(false) |
enable_position_increments | Indicates if position increments should be counted. Set to false if you don’t want to count tokens removed by analyzer filters (like stop). Defaults to true. |
dynamic | 新属性是否应动态添加到现有对象。接受 true (默认), false 和 strict。 |
doc_values | 该字段是否应该以多列的方式存储在磁盘上,以便以后可以将其用于排序,聚合或脚本? 接受true(默认)或false。 |
fielddata | 是否可以使用内存中的字段数据进行排序,聚合或脚本编写? true或false (默认)。 |
fielddata_frequency_filter | 此为高级设置,允许在fielddata启用时决定哪些值加载到内存中。 默认情况下,所有值都被加载。 |
fields | 多字段允许以多种方式将相同的字符串值索引到不同的目的,例如用于搜索的一个字段和用于排序和聚合的多字段,或由不同分析器分析的相同字符串值。 |
format | 可以解析的日期格式。默认是strict_date_optional_time||epoch_millis。 |
ignore_above | Do not index any string longer than this value. Defaults to 2147483647 so that all values would be accepted. |
ignore_malformed | 如果为真,则格式错误的数字将被忽略。 如果为false(默认),格式错误的数字会引发异常并拒绝整个文档。 |
ignore_z_value | If true (default) three dimension points will be accepted (stored in source) but only latitude and longitude values will be indexed; the third dimension is ignored. If false, geo-points containing any more than latitude and longitude (two dimensions) values throw an exception and reject the whole document. |
include_in_all | 字段值是否应包含在_all字段中? 接受true或false 。如果index设置为no ,或者如果父object字段将include_in_all,默认设置为false。 否则默认为true 。 |
index | 应该可以搜索该字段吗? 接受true (默认)或false 。 |