Skip to content

Conversation

@astefan
Copy link
Contributor

@astefan astefan commented Feb 14, 2021

Adds a "fields" section to the body of an eql request, identical to how a _search endpoint handles a "fields" request element.

Addresses #68115.

@elasticmachine elasticmachine added the Team:QL (Deprecated) Meta label for query languages team label Feb 14, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-ql (Team:QL)

@astefan astefan requested review from bpintea, costin and matriv February 14, 2021 10:15
Copy link
Member

@costin costin left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM.

// NB:this is different from mget
.size(idQuery.ids().size());
if (fetchFields != null) {
fetchFields.stream().forEach(f -> builder.fetchField(f));
Copy link
Member

Choose a reason for hiding this comment

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

forEach exists directly on List - no need to create the stream.
Also use the method reference : fetchFields.forEach(builder::fetchField)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed. Thanks.


// add the "fields" to be fetched
if (fetchFields != null) {
fetchFields.stream().forEach(f -> source.fetchField(f));
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as above re: forEach & method reference.

Copy link
Contributor

@matriv matriv left a comment

Choose a reason for hiding this comment

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

LGTM. Left a question regarding serialisation.

if (out.getVersion().onOrAfter(Version.V_7_10_0)) { // TODO: Remove after backport
out.writeString(resultPosition);
}
if (out.getVersion().onOrAfter(Version.V_7_12_0)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be V_8_0_0 for now and once backported switch to V_8_0_0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@matriv @bpintea Actually, the new test I added - https://github.com/elastic/elasticsearch/pull/68962/files#diff-7e1220049ee22470c58a915155e9d9bd3ef7742523a6bfd0e71b8c463df3e638 - won't let me use V_8_0_0 because a version 8.0 of ES should be compatible with the latest version 7.x of ES (which is 7.12). And the test in AbstractBWCSerializationTestCase is doing serialization and deserialization on 7.12 and compares the deserialized instance with the original (8.0) instance. And the test fails, because the two instances should be equal.

if (in.getVersion().onOrAfter(Version.V_7_10_0)) {
resultPosition = in.readString();
}
if (in.getVersion().onOrAfter(Version.V_7_12_0)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Contributor

Choose a reason for hiding this comment

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

There are a couple more instances of this test. But I assume it's fine, since there aren't bwc integration tests like we have for SQL, so this should work?

Copy link
Contributor

@bpintea bpintea left a comment

Choose a reason for hiding this comment

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

LGTM

protected EqlSearchRequest createTestInstance() {
try {
List<FieldAndFormat> randomFetchFields = new ArrayList<>();
for (int j = 0; j < randomIntBetween(0, 5); j++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Still getting you a random number of iterations, but the exit condition is (likely) going to change with each iteration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed. Nice catch!

if (in.getVersion().onOrAfter(Version.V_7_10_0)) {
resultPosition = in.readString();
}
if (in.getVersion().onOrAfter(Version.V_7_12_0)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There are a couple more instances of this test. But I assume it's fine, since there aren't bwc integration tests like we have for SQL, so this should work?

@astefan
Copy link
Contributor Author

astefan commented Feb 15, 2021

@elasticmachine run elasticsearch-ci/2

@astefan
Copy link
Contributor Author

astefan commented Feb 15, 2021

@elasticmachine update branch

@astefan
Copy link
Contributor Author

astefan commented Feb 25, 2021

CC @jrodewig. Sorry for the delay.

@jrodewig
Copy link
Contributor

No worries. Thanks @astefan. I'll work on a related docs PR for these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants