-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Remove types from percolate query API #46985
Remove types from percolate query API #46985
Conversation
Pinging @elastic/es-search |
@elasticsearch update branch |
@elasticmachine update branch |
@elasticmachine run elasticsearch-ci/bwc |
@elasticmachine run elasticsearch-ci/2 |
This ILM test keeps failing, but it seems to be completely unrelated and doesn't reproduce locally for me at all:
@elasticmachine run elasticsearch-ci/2 |
this(field, Collections.singletonList(document), documentXContentType); | ||
} | ||
|
||
private PercolateQueryBuilder(String field, BytesReference document) { |
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.
I think this constructor is unused.
@@ -354,7 +332,7 @@ public void testSettingNameWhileRewritingWhenDocumentSupplierAndSourceNotNull() | |||
Supplier<BytesReference> supplier = () -> new BytesArray("{\"test\": \"test\"}"); | |||
String testName = "name1"; | |||
QueryShardContext shardContext = createShardContext(); | |||
PercolateQueryBuilder percolateQueryBuilder = new PercolateQueryBuilder(queryField, null, supplier); | |||
PercolateQueryBuilder percolateQueryBuilder = new PercolateQueryBuilder(queryField, supplier::get); |
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, could this just be new PercolateQueryBuilder(queryField, supplier)
?
/** | ||
* Read from a stream. | ||
*/ | ||
PercolateQueryBuilder(StreamInput in) throws IOException { | ||
super(in); | ||
field = in.readString(); | ||
name = in.readOptionalString(); | ||
documentType = in.readOptionalString(); | ||
if (in.getVersion().before(Version.V_8_0_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.
For this query type, a 7.x 'typeless' query is represented by a null documentType
and indexedDocumentType
. So I think that here and in doWriteTo
, we should always assume these parameters are null
instead of _doc
.
@@ -281,9 +245,13 @@ protected void doWriteTo(StreamOutput out) throws IOException { | |||
} | |||
out.writeString(field); | |||
out.writeOptionalString(name); | |||
out.writeOptionalString(documentType); | |||
if (out.getVersion().before(Version.V_8_0_0)) { | |||
out.writeOptionalString(MapperService.SINGLE_MAPPING_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.
Related to my comment on the previous revision, I think we should write null
here. In 7.x, a 'typeless' percolate query is represented by a null documentType and indexedDocumentType.
Previously removed in elastic#46985. The yaml test is included in this PR, but will be removed once elastic#74689 is merged.
Relates to #41059