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
Make PUT consistent for _mapping
, _alias
and _warmer
#4687
Conversation
@@ -158,12 +158,13 @@ curl -XGET 'http://localhost:9200/alias2/_search?q=user:kimchy&routing=2,3' | |||
There is also an api to add a single index alias, with options: | |||
|
|||
[horizontal] | |||
`index`:: The index to alias refers to. This is a required option. | |||
`index`:: The index to alias refers to. Can be any of `blank | * | _all | regex | name1, name2, …` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regex -> glob
LGTM, would be great if @clintongormley can review the rest tests and the behavior as well... |
I updated the pull request and added also the changes for DELETE. I think it makes sense to squash the commits for DELETE and PUT _alias (7c9f814, 7188455) because they both touch the same files. |
out.writeString(index); | ||
out.writeString(alias); | ||
out.writeOptionalString(index); | ||
out.writeOptionalString(alias); | ||
if (filter == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe replace these with writeOptionalString as well while you are at it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
The output from putting a mapping with no type specified seem strange: pre-this-change:
Output:
post-this-change:
Output:
Is this intended? The double-wrapping of types in the post-change seems incorrect to me. |
There is also an api to add a single index alias, with options: | ||
An alias can also be added with the endpoint | ||
|
||
`[PUT|POST] /{index}/_alias/{name}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if we happen to support POST for doing that, should we rather document only PUT to make it more REST-ish?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@dakrone about the double wrapping: when you call
this creates and index named When you call
this creates the type
but since we now can leave the index blank this means that when using the uri
If this is too confusing maybe we should remove the old uris
and
? |
@brwe Agreed that is confusing. Would it be possible to only support the old URLs by making |
I'd like to keep the old URLs around, to make migration easier, but if we can't do the above, then I'd be leaning towards making |
@clintongormley @dakrone ok, it is easy to remove the options and only keep the old functionality. Should we then remove |
if (filter == null) { | ||
out.writeBoolean(false); | ||
} else { | ||
out.writeBoolean(true); | ||
out.writeString(filter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these replacements seem to be wrong the if / else logic is obsolete now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, will remove
@imotov @dakrone @s1monw @clintongormley Thanks so much for the review! I updated the pull request with the following changes:
Next, I will squash and push. |
See issue elastic#4071 PUT options for _mapping: Single type can now be added with `[PUT|POST] {index|_all|*|regex|blank}/[_mapping|_mappings]/type` and `[PUT|POST] {index|_all|*|regex|blank}/type/[_mapping|_mappings]` PUT options for _warmer: PUT with a single warmer can now be done with `[PUT|POST] {index|_all|*|prefix*|blank}/{type|_all|*|prefix*|blank}/[_warmer|_warmers]/warmer_name` PUT options for _alias: Single alias can now be PUT with `[PUT|POST] {index|_all|*|prefix*|blank}/[_alias|_aliases]/alias` DELETE options _mapping: Several mappings can be deleted at once by defining several indices and types with `[DELETE] /{index}/{type}` `[DELETE] /{index}/{type}/_mapping` `[DELETE] /{index}/_mapping/{type}` where `index= * | _all | glob pattern | name1, name2, …` `type= * | _all | glob pattern | name1, name2, …` Alternatively, the keyword `_mapings` can be used. DELETE options for _warmer: Several warmers can be deleted at once by defining several indices and names with `[DELETE] /{index}/_warmer/{type}` where `index= * | _all | glob pattern | name1, name2, …` `type= * | _all | glob pattern | name1, name2, …` Alternatively, the keyword `_warmers` can be used. DELETE options for _alias: Several aliases can be deleted at once by defining several indices and names with `[DELETE] /{index}/_alias/{type}` where `index= * | _all | glob pattern | name1, name2, …` `type= * | _all | glob pattern | name1, name2, …` Alternatively, the keyword `_aliases` can be used.
LGMT +1 to push Good Job!! |
pushed to master (411739f) |
This pull request makes consistent the PUT for
_mapping
,_alias
and_warmer
as described in issue #4071._mapping
:Single type can now be added with
[PUT|POST] {index|_all|*|regex|blank}/[_mapping|_mappings]/type
and
[PUT|POST] {index|_all|*|regex|blank}/type/[_mapping|_mappings]
_warmer
A single warmer can now be put with
[PUT|POST] {index|_all|*|prefix*|blank}/{type|_all|*|prefix*|blank}/[_warmer|_warmers]/warmer_name
_alias
A single alias can now be PUT with
[PUT|POST] {index|_all|*|prefix*|blank}/[_alias|_aliases]/alias