Mapping的作用

Mapping会把JSON文档映射成 Lucene 所需要的扁平格式

字段的数据类型

ES 中不存在数组类型, 其本质还是字段的基本类型

设置

设置Dynamic Mapping

PUT movies
{
	"mappings": {
		"_doc": {
			"dynamic": "false"
		}
	}
}

指定字段

PUT movies
{
	"mappings": {
		"properties": {
			"field1": {"type": "text"},
			"field2": {"type": "text", "index": false}
		}
	}
}

index 参数控制字段是否能够被搜索

index_options 可以控制好倒排索引记录的内容, 记录内容越多,占用存储空间越大. 它可以有如下值