【问题标题】:Elasticsearch alias index routingElasticsearch 别名索引路由
【发布时间】:2016-08-29 11:47:47
【问题描述】:

我创建了两个测试索引和一个与之关联的别名:

POST /_aliases
{
"actions" : [
    { 
      "add" : { 
        "index" : "test", 
        "alias" : "alias_test",
        "index_routing" : "1"
      }
    },
    {
      "add" : {
        "index" : "test2", 
        "alias" : "alias_test"
      }
    }
]
}

但是,当我尝试使用 routing=1 将文档索引到 test 索引时,它仍然抛出错误:

POST alias_test/test/test?routing=1
{
"user" : "kimchy",
"post_date" : "2009-11-15T14:12:12",
"message" : "trying out Elasticsearch"   
}

错误信息:

{
"error": {
  "root_cause": [
     {
        "type": "illegal_argument_exception",
        "reason": "Alias [alias_test] has more than one indices associated with it [[test2, test]], can't execute a single index op"
     }
  ],
  "type": "illegal_argument_exception",
  "reason": "Alias [alias_test] has more than one indices associated with it [[test2, test]], can't execute a single index op"
},
"status": 400
}

有什么建议吗?

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    当你想索引一个新文档时,你不能使用指向多个索引的别名,在这种情况下你需要使用索引名称

    use the index name here
           |
           v
    POST test/test/test?routing=1
    {
    "user" : "kimchy",
    "post_date" : "2009-11-15T14:12:12",
    "message" : "trying out Elasticsearch"   
    }
    

    【讨论】:

    • 这个运气好吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-31
    相关资源
    最近更新 更多