elasticsearch mapping
索引管理 创建索引 直接创建索引 PUT newindex1,创建索引可以通过 number_of_shares 和 number_of_replicas 数量来修饰分片和副本的数量。 text 1 2 3 4 5 6 7 8 9 PUT newindex { "settings": { "index" : { "number_of_shares" : 2, "number_of_replicas": 1 } } } number_of_shares 分片数在创建索引后不能修改 number_of_replicas 副本数可以随时完成修改 删除索引 DEL index_name 打开/关闭索引 POST {index_name}/_close POST {index_name}/_open 关闭的索引无法进行【增删改查】操作 text 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 { "error" : { "root_cause" : [ { "type" : "index_closed_exception", "reason" : "closed", "index_uuid" : "3eCslZZ3Q9amlUyDtqTXWA", "index" : "newindex" } ], "type" : "index_closed_exception", "reason" : "closed", "index_uuid" : "3eCslZZ3Q9amlUyDtqTXWA", "index" : "newindex" }, "status" : 400 } 索引的映射 mapping mapping是定义文档及包含字段的存储与索引方式。可以理解为是elasticsearch的表结构,定义mapping,即在创建index时,自行判断每个字段的类型,而不是有ES自动自动判断每个纬度的类型。这种更贴合业务场景,如分词、存储。...