Alias and Write index


(Václav Šulc) #1

Hello,
I have problem with setting an write index within alias. Could you please tell me what am I doing wrong?
I am using Elasticsearch version 6.3.2. I tried steps below on version 6.5.4 and it worked well.

CREATING INDICES

curl -X PUT "localhost:9200/index-2019.02.11"
curl -X PUT "localhost:9200/index-2019.02.10"
curl -X PUT "localhost:9200/index-2019.02.09"
curl -X PUT "localhost:9200/index-2019.02.08"

SETTING ALIAS FOR INDICES

POST /_aliases
{
    "actions" : [
        { "add" : { "index" : "index-*", "alias" : "alias-index"} }
    ]                
}                                

WATCHING ALIASES

watch -n5 'curl --silent -XGET localhost:9200/_cat/aliases | grep ^alias-index'

alias-index index-2019.02.08 - - -
alias-index index-2019.02.09 - - -
alias-index index-2019.02.10 - - -
alias-index index-2019.02.11 - - -

SETTING INDEX index-2019.02.11 AS WRITE INDEX

curl -X POST "localhost:9200/_aliases" -H 'Content-Type: application/json' -d'
{
    "actions" : [
        {
            "add" : {
                 "index" : "index-2019.02.11",
                 "alias" : "alias-index",
                 "is_write_index" : true
            }
        }
    ]
}
'

IN VERSION 6.5.4 I GOT
{"acknowledged":true}

IN VERSION 6.3.2 I GOT
{
"error" : {
"root_cause" : [
{
"type" : "x_content_parse_exception",
"reason" : "[8:18] [alias_action] failed to parse field [add]"
}
],
"type" : "x_content_parse_exception",
"reason" : "[8:18] [aliases] failed to parse field [actions]",
"caused_by" : {
"type" : "x_content_parse_exception",
"reason" : "[8:18] [alias_action] failed to parse field [add]",
"caused_by" : {
"type" : "illegal_argument_exception",
"reason" : "[add] unknown field [is_write_index], parser not found"
}
}
},
"status" : 400
}

Is it possible to set write index in version 6.3.2 or upgrade is necessary? Could you please help me how to set write index on ES v. 6.3.2?

Regards,
Vašek


(David Turner) #2

The is_write_alias flag was added in 6.4 (see #31412).


(Václav Šulc) #3

Thank you David!


(system) closed #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.