Add include_metadata request parameter for PPL queries #5235#5412
Add include_metadata request parameter for PPL queries #5235#5412ishag4 wants to merge 3 commits into
Conversation
…ject#5235 Signed-off-by: Isha Gupta <igupta24@apple.com>
PR Reviewer Guide 🔍(Review updated until commit 05e612c)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 05e612c Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 8b3962e
Suggestions up to commit b79855b
Suggestions up to commit 85f18b2
Suggestions up to commit 6028130
|
|
Hi @LantaoJin @penghuo @RyanL1997 @Swiddis Could you please review? |
LantaoJin
left a comment
There was a problem hiding this comment.
Please add integration tests for this enhancement and update documentation (add a new section in endpoint.md
Signed-off-by: Isha Gupta <igupta24@apple.com>
|
Persistent review updated to latest commit b79855b |
|
Hi @LantaoJin @penghuo @RyanL1997 @Swiddis Could you please re-review? |
Swiddis
left a comment
There was a problem hiding this comment.
One issue, a few suggestions & polish
| HighlightConfig highlightConfig, | ||
| boolean includeMetadata) { |
There was a problem hiding this comment.
suggestion: It may be worth merging this with HighlightConfig and renaming it to something like QueryConfig (with fieldNames -> highlightFieldNames and toFieldMap -> highlightFieldMap)
Semantically they're similar in that they provide different ways the query might run, and this means we don't now need to be passing two parameters everywhere. It'd overall reduce the one-liner changes of "the same code but add a field" and make it easier to add more config in the future.
There was a problem hiding this comment.
Good suggestion.
I agree a shared QueryConfig (or similar) would likely scale better than continuing to thread individual execution flags through constructors/methods.
We can avoid doing that in this PR mainly to keep the scope focused on include_metadata behavior itself and minimize the amount of unrelated refactoring/review surface.
That said, now that we have both HighlightConfig and includeMetadata, I can definitely see the benefit of consolidating execution-time options before more flags get added.
Happy to follow up with a separate cleanup/refactor PR if that direction makes sense.
|
Persistent review updated to latest commit 8b3962e |
Signed-off-by: Isha Gupta <igupta24@apple.com>
|
Persistent review updated to latest commit 05e612c |
Description
Add a request-level parameter include_metadata to the PPL query API:
POST /_plugins/_ppl?include_metadata=true
{
"query": "source=logs | where level='ERROR' | fields * | head 10"
}
Result: All regular fields PLUS metadata fields (_id, _index, _score, etc.)
Related Issues
Resolves #5235
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.