Elasticsearch: multi indices one type OR one index multi types -


as the definitive guide -> indexing employee documents said

relational db ⇒ databases ⇒ tables ⇒ rows ⇒ columns

elasticsearch ⇒ indices ⇒ types ⇒ documents ⇒ fields

and the definitive guide -> index aliases , 0 downtime said

be prepared: use aliases instead of indices in application. able reindex whenever need to. aliases cheap , should used liberally.

the question is, if indices databases, if want rebuild 1 type(table) have reindex whole database, reasonable ? (this one index multi types).

or have create many indices project , every index has 1 type, sounds project has dozens databases!

i think understand confusion. have 1 index named my_index , 3 types type1, type2 , type3. create alias alias1 index.

now want change mapping of type1, need reindex every document of type1 want zero downtime create new index index2 , reindex documents of type1 , if want alias1 refer new index, problem arise , said have reindex other types if want zero downtime. if ok downtime can delete documents , reindex them.

to solve above issue should create multiple aliases same index beforehand described here,look section named using aliases greater flexibility . create 3 aliases current index

curl - xpost localhost:9200/_aliases - d ' {     "actions": [{         "add": {             "alias": "type1_alias",             "index": "index1"         }     }, {         "add": {             "alias": "type2_alias",             "index": "index1"         }     },     {         "add": {             "alias": "type3_alias",             "index": "index1"         }     }] } ' 

now index type1 docs type1_alias , on. whenever want rebuild specific type can create new index , assign specific type alias new index. have remove particular type documents old index(index1 in case)

this have been lot easier if alias had support on type level, opened issue closed due complexity guess.

hope helps!!


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -