簡體   English   中英

Elasticsearch和Spring Data:如何使用別名重新索引

[英]Elasticsearch and Spring Data: how to reindex with alias

我有一個這樣注釋的bean:

@Document(indexName = "foo", type = "bar")
public class BarEntity {
    private String someField = "";
}

“ foo”是elasticsearch中對foo-2016-11-04的別名:

"foo-2016.11.04" : {
  "aliases" : {
    "foo" : { }
  }
}

我想要做的是將someField的索引更改為not_analyzed:

@Document(indexName = "foo", type = "bar")
public class BarEntity {
    @Field(index = FieldIndex.not_analyzed, type = FieldType.String)
    private String someField = "";
}

據我所知,我將必須創建一個新索引並將別名指向該索引,例如foo-2016.11.29。

如何在帶有Spring Data的elasticeseach 2.3中做到這一點? 我的bean鏈接到別名,我猜Spring Data會自動創建正確的索引。
我只是不知道如何通過別名來創建索引。

我是否首先將foo-2016.11.04重新索引為foo-2016.11.29,更新別名以指向新的別名,然后重新部署spring應用程序,還是在這里做其他事情?

您無法通過別名創建索引,但可以顯式創建帶有時間戳的索引,並使用索引模板將其自動分配給別名。

https://www.elastic.co/guide/zh-CN/elasticsearch/reference/2.3/indices-templates.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM