我正在使用以下json配置elasticsearch。目标是一举设置索引和类型(这是要求,设置泊坞窗图像)。据我所知,这将使elasticsearch成功启动。问题是索引没有创建但它没有错误。我试过的其他形式会阻止服务启动。
{
"cluster": {
"name": "MyClusterName"
},
"node": {
"name": "MyNodeName"
},
"indices": {
"number_of_shards": 4,
"index.number_of_replicas": 4
},
"index": {
"analysis": {
"analyzer": {
"my_ngram_analyzer": {
"tokenizer": "my_ngram_tokenizer",
"filter": "lowercase"
},
"my_lowercase_whitespace_analyzer": {
"tokenizer": "whitespace",
"filter": "lowercase"
}
},
"tokenizer": {
"my_ngram_tokenizer": {
"type": "nGram",
"min_gram": "2",
"max_gram": "20"
}
}
},
"index": {
"settings": {
"_id": "indexindexer"
},
"mappings": {
"inventoryIndex": {
"_id": {
"path": "indexName"
},
"_routing": {
"required": true,
"path": "indexName"
},
"properties": {
"indexName": {
"type": "string",
"index": "not_analyzed"
},
"startedOn": {
"type": "date",
"index": "not_analyzed"
},
"deleted": {
"type": "boolean",
"index": "not_analyzed"
},
"deletedOn": {
"type": "date",
"index": "not_analyzed"
},
"archived": {
"type": "boolean",
"index": "not_analyzed"
},
"archivedOn": {
"type": "date",
"index": "not_analyzed"
},
"failure": {
"type": "boolean",
"index": "not_analyzed"
},
"failureOn": {
"type": "date",
"index": "not_analyzed"
}
}
}
}
}
}
}
我可能在后启动脚本中使用curl的解决方法,但我更愿意在配置文件中处理配置。
谢谢!
答案 0 :(得分:0)
似乎elasticsearch不允许在一个yml中完成所有配置。我找到的解决方法是创建一个索引模板并将其放在<es-config>/templates/
目录中,然后在启动服务后我使用curl创建索引。索引匹配将捕获它并根据模板进行配置。
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html