What are aliases in elasticsearch for?

后端 未结 3 1159
挽巷
挽巷 2020-12-15 12:47

I recently started working in a company that uses Elasticsearch. While most of its concepts are somewhat similar to relational databases and I am able to understand them, I

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-15 13:24

    aliases are like soft links or shortcuts to actual indexes

    the advantage is to be able to have an alias pointing to index1a while building or re-indexing on index2b and the moment of swapping them is atomic thanks to the alias, to which all code should point

    Renaming an alias is a simple remove then add operation within the same API. This operation is atomic, no need to worry about a short period of time where the alias does not point to an index:

    [EDIT] as pointed out @wholevinski aliases have other functionalities like:

    Multiple indices can be specified for an action ...

    all the info is in the page you have linked

    [EDIT2] more on why the need/benefit of the atomicity

    the key being "zero downtime" https://en.wikipedia.org/wiki/Zero_unscheduled_downtime or https://en.wikipedia.org/wiki/High_availability

    https://www.elastic.co/guide/en/elasticsearch/guide/current/index-aliases.html

    We will talk more about the other uses for aliases later in the book. For now we will explain how to use them to switch from an old index to a new index with zero downtime.

提交回复
热议问题