Skip to content

add missing test2 index in alias example #39212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions docs/reference/indices/aliases.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,18 @@ POST /_aliases
"alias" : "alias1",
"is_write_index" : true
}
},
{
"add" : {
"index" : "test2",
"alias" : "alias1"
}
}
]
}
--------------------------------------------------
// CONSOLE
// TEST[s/^/PUT test\n/]
// TEST[s/^/PUT test\nPUT test2\n/]

In this example, we associate the alias `alias1` to both `test` and `test2`, where
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading the rest of this example, I think the final section may be incorrect as well:

To swap which index is the write index for an alias, the Aliases API can be leveraged to
do an atomic swap. The swap is not dependent on the ordering of the actions.

POST /_aliases
{
    "actions" : [
        {
            "add" : {
                 "index" : "test",
                 "alias" : "alias1",
                 "is_write_index" : true
            }
        }, {
            "add" : {
                 "index" : "test2",
                 "alias" : "alias1",
                 "is_write_index" : false
            }
        }
    ]
}

Given the description, it seems like the boolean values for is_write_index should be flipped. I think it'd be nice to fix that in this PR as well, if you also think that's reasonable?

Copy link
Contributor Author

@talevy talevy Feb 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I see. I think, when writing the docs, this was meant to be thought of as a separate example. Now I see that it feels like a continuation of the previous

`test` will be the index chosen for writing to.
Expand Down Expand Up @@ -311,13 +317,13 @@ POST /_aliases
"add" : {
"index" : "test",
"alias" : "alias1",
"is_write_index" : true
"is_write_index" : false
}
}, {
"add" : {
"index" : "test2",
"alias" : "alias1",
"is_write_index" : false
"is_write_index" : true
}
}
]
Expand Down