我正在尝试仅针对特定索引禁用动态映射创建,而不是针对所有索引.出于某种原因,我不能将默认映射与'dynamic':'false' 放在一起.所以,我可以看到两个选项:
第一个选项可能只接受值:true,false和strict.所以没有办法指定特定索引的子集(就像我们通过带有属性'action.auto_create_index'的 模式一样' https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#索引创建).
第二个选项不起作用.我创建了索引
POST http://localhost:9200/test_idx/
{
"settings" : {
"mapper" : {
"dynamic" : false
}
},
"mappings" : {
"test_type" : {
"properties" : {
"field1" : {
"type" : "string"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
然后检查索引设置:
GET http://localhost:9200/test_idx/_settings
{
"test_idx" : {
"settings" : {
"index" : {
"mapper" : {
"dynamic" : "false"
},
"creation_date" : "1445440252221",
"number_of_shards" : "1", …Run Code Online (Sandbox Code Playgroud)