Skip to content

QL: Adapt nested fields extraction from "fields" API output to the new un-flattened strucutre #68745

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

Conversation

astefan
Copy link
Contributor

@astefan astefan commented Feb 9, 2021

"fields" API ouput for nested fields is returning the values in a way that keeps the relationship between nested documents
Addresses #68722

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

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

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

DocumentField field = hit.field(fieldName);
DocumentField field = null;
if (hitName != null) {
// a nested field value is grouped under the nested parent name (ie dep.dep_name lives under "dep":[{dep_name:value}])
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// a nested field value is grouped under the nested parent name (ie dep.dep_name lives under "dep":[{dep_name:value}])
// a nested field value is grouped under the nested parent name (ie dep.dep_name lives under "dep":[{"dep_name":value}])

// a nested field value is grouped under the nested parent name (ie dep.dep_name lives under "dep":[{dep_name:value}])
field = hit.field(hitName);
} else {
field = hit.field(fieldName);
Copy link
Contributor

Choose a reason for hiding this comment

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

To make sure, the fieldName is in this case a "doc-top-level" field, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fieldName is the full field name (including the path): dep.dep_name for example.

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

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.

LGTM. Thanks for the fast turnaround.

Copy link
Contributor

@palesz palesz left a comment

Choose a reason for hiding this comment

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

LGTM

@astefan astefan merged commit 72a3371 into elastic:ql_fields_api_implementation Feb 9, 2021
@astefan astefan deleted the 68722_implementation branch February 9, 2021 21:55
astefan added a commit that referenced this pull request Feb 10, 2021
* Integrate "fields" API into QL (#68467)
* QL: retry SQL and EQL requests in a mixed-node (rolling upgrade) cluster (#68602)
* Adapt nested fields extraction from "fields" API output to the new un-flattened structure (#68745)
astefan added a commit to astefan/elasticsearch that referenced this pull request Feb 10, 2021
* Integrate "fields" API into QL (elastic#68467)
* QL: retry SQL and EQL requests in a mixed-node (rolling upgrade) cluster (elastic#68602)
* Adapt nested fields extraction from "fields" API output to the new un-flattened structure (elastic#68745)

(cherry picked from commit ee5cc54)
astefan added a commit that referenced this pull request Feb 10, 2021
* Integrate "fields" API into QL (#68467)
* QL: retry SQL and EQL requests in a mixed-node (rolling upgrade) cluster (#68602)
* Adapt nested fields extraction from "fields" API output to the new un-flattened structure (#68745)

(cherry picked from commit ee5cc54)
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.

7 participants