前面也提到过关于手动创建mapping,接着上一篇关于object类型存储以及mapping的介绍,我们接下来就介绍下如何手动创建mapping
#手动创建mapping
PUT /lib6
{
"settings":{
"number_of_shards" : 3,
"number_of_replicas" : 0
},
"mappings":{
"books":{
"properties":{
"title" :{"type":"text"},
"name" :{"type" :"text" ,"analyzer":"standard"},
"publish_date" :{"type":"date", "index" :false},
"price" :{"type" :"double"},
"number":{"type":"integer"}
}
}
}
}
默认情况下,ElasticSearch自动会为每一个字段建立倒排索引,如果我们不希望被索引,index:false