Skip to content

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

Merged
astefan merged 2 commits intoelastic:ql_fields_api_implementationfrom
astefan:68722_implementation
Feb 9, 2021
Merged

QL: Adapt nested fields extraction from "fields" API output to the new un-flattened strucutre#68745
astefan merged 2 commits intoelastic:ql_fields_api_implementationfrom
astefan:68722_implementation

Conversation

@astefan
Copy link
Copy Markdown
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
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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