-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Deprecate use of type in reindex request body #36823
Conversation
Pinging @elastic/es-search |
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.
Thanks @cbuescher, looks good overall.
The main question I have is about the interpretation of "Deprecate use of type". I imagined that for any reference to type
, even though it is equal to _doc
, we should issue a deprecation warning. @jtibshirani what do you think?
I was going after something like I saw in RestGetAction where we check |
I agree that we want to log a deprecation warning anytime that I also wanted to note that you may be seeing search-related deprecation warnings when using |
@jtibshirani @mayya-sharipova thanks for the feedback, I pushed an update. |
09318d3
to
bc82cfa
Compare
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.
Thanks @cbuescher, this is looking good to me! I think we'll also need to update ReindexIT
to remove references to types.
modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java
Show resolved
Hide resolved
modules/reindex/src/test/java/org/elasticsearch/index/reindex/RestReindexActionTests.java
Outdated
Show resolved
Hide resolved
modules/reindex/src/test/java/org/elasticsearch/index/reindex/RestReindexActionTests.java
Outdated
Show resolved
Hide resolved
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.
Thanks @cbuescher, LGTM
@jtibshirani I think I adressed you latest round of comments, running the test now but I think this should be good to go now? |
Types can be used both in the source and dest section of the body which will be translated to search and index requests respectively. Adding a deprecation warning for those cases and removing examples using more than one type in reindex since support for this is going to be removed.
1304efb
to
7dccd45
Compare
@elasticmachine test this please |
1 similar comment
@elasticmachine test this please |
@elasticmachine test this please |
@jtibshirani I just that now the IndexRequest (used for the reindex destination) always contains a non-null type ("_doc" by default, this might be a recent change, I haven't seen related tests failing before). Also the SearchRequest used in the source section always prints the "type" field to xContent even if no types are set, so we will alway see a warning when going e.g. through the High Level Rest Client. I think we need to change the ReindexRequest xContent output slightly so that the "type" fields are not printed when they are not set (e.g. when coming from HLRest) |
@jtibshirani thanks for the thumbs up but the last failures in the high level client tests uncovered what I think were some problems with the xContent output of the current ReindexRequest. Can you take a look at the recent commit and let me know if you agree with not outputting empty or default type fields in the ReindexRequest is serialized via toXContent? This would mean we still warn when empty/default types names are sent directly via REST, but we wouldn't send them outselves when using e.g. the HL client. |
@@ -294,15 +295,19 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws | |||
builder.field("remote", remoteInfo); | |||
} | |||
builder.array("index", getSearchRequest().indices()); | |||
builder.array("type", getSearchRequest().types()); | |||
String[] types = getSearchRequest().types(); | |||
if (types != null && types.length > 0) { |
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.
Super small comment -- I don't think these null checks are necessary, since SearchRequest
validates that the types
array can't be null. Similarly, IndexRequest
validates that the type is not 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.
IndexRequest
validates that the type is not null
Unfortunately this is done in validate()
only, so its possible to set a null
type via the ctors or the setter and then xContent serialization would break. For SearchRequest
I think you are right and types cannot be null
so I will remove the check there but leave it for IndexRequest.
@cbuescher thanks for double-checking, I agree with this approach to |
This bit us on site today because the 7.x docs don't mention Can we at least re-document it for |
Types can be used both in the
source
anddest
section of the body which willbe translated to search and index requests respectively. Adding a deprecation warning
for those cases and removing examples using more than one type in reindex since
support for this is going to be removed.