(七)Create an Index

Now let’s create an index named "customer" and then list all the indexes again:node

如今讓咱們建立一個名爲「customer」的索引,而後再次列出全部索引:
PUT /customer?pretty
GET /_cat/indices?v

The first command creates the index named "customer" using the PUT verb. We simply append pretty to the end of the call to tell it to pretty-print the JSON response (if any).app

第一個命令使用PUT動詞建立名爲「customer」的索引。咱們只是簡單地追加到調用的結尾,告訴它打印JSON響應(若是有的話)。
And the response:
health status index    uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   customer 95SQ4TSUT7mWBT7VNHH67A   5   1          0            0       260b           260b

The results of the second command tells us that we now have 1 index named customer and it has 5 primary shards and 1 replica (the defaults) and it contains 0 documents in it.ui

第二個命令的結果告訴咱們,咱們如今有一個名爲customer的索引,它有5個主分片和1個副本(默認值),而且它包含0個文檔。
 
You might also notice that the customer index has a yellow health tagged to it. Recall from our previous discussion that yellow means that some replicas are not (yet) allocated. The reason this happens for this index is because Elasticsearch by default created one replica for this index. 
您可能還注意到客戶索引標記了黃色運行情況。回想一下咱們以前的討論,黃色表示某些副本還沒有(還沒有)分配。此索引起生這種狀況的緣由是由於默認狀況下Elasticsearch爲此索引建立了一個副本。
 
Since we only have one node running at the moment, that one replica cannot yet be allocated (for high availability) until a later point in time when another node joins the cluster. Once that replica gets allocated onto a second node, the health status for this index will turn to green.
因爲咱們目前只有一個節點在運行,所以在另外一個節點加入集羣的較晚時間點以前,尚沒法分配一個副本(用於高可用性)。將該副本分配到第二個節點後,此索引的運行情況將變爲綠色。
相關文章
相關標籤/搜索