gpt4 book ai didi

json - 使用json不配置Elasticsearch索引

转载 作者:行者123 更新时间:2023-12-03 00:26:05 26 4
gpt4 key购买 nike

我正在使用以下json配置elasticsearch。目标是一口气设置索引和类型(这是设置docker镜像的要求)。据我所知,这将使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的解决方法,但我希望在config文件中处理配置。

谢谢!

最佳答案

似乎elasticsearch不允许所有配置在一个yml中完成。我发现的解决方法是创建索引模板并将其放置在<es-config>/templates/目录中,然后在拆分服务之后,我使用curl来创建索引。索引匹配将捕获它并根据模板进行配置。

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html

关于json - 使用json不配置Elasticsearch索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25373123/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com