【问题标题】:configure an elasticsearch index with json not taking配置不带json的elasticsearch索引
【发布时间】:2014-10-11 22:42:15
【问题描述】:

我正在使用以下 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 的解决方法,但我希望在配置文件中处理配置。

谢谢!

【问题讨论】:

    标签: json indexing elasticsearch config


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2018-07-23
      • 2016-09-27
      • 1970-01-01
      • 1970-01-01
      • 2016-06-07
      • 1970-01-01
      • 1970-01-01
      • 2016-05-21
      • 2016-01-25
      相关资源
      最近更新 更多