-
Notifications
You must be signed in to change notification settings - Fork 580
adding wrapper dsl query docs #9939
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
Changes from 2 commits
f59b046
38e2e84
35862ca
2cc2ac9
243ff5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
|
||
layout: default | ||
title: Wrapper | ||
parent: Specialized queries | ||
nav_order: 80 | ||
--- | ||
|
||
# Wrapper | ||
|
||
The `wrapper` query lets you submit a complete query in Base64-encoded JSON format. It is useful when the query must be embedded in contexts that only support string values. | ||
|
||
Use this query only when you need to work around system constraints. For readability and maintainability, it's better to use standard JSON-based queries when possible. | ||
|
||
## Example use case | ||
|
||
If you want to run the following query: | ||
|
||
```json | ||
{ | ||
"match": { | ||
"title": "headphones" | ||
} | ||
} | ||
``` | ||
|
||
Encode this JSON as a Base64 string. The Base64-encoded version is: | ||
|
||
``` | ||
eyAibWF0Y2giOiB7InRpdGxlIjogImhlYWRwaG9uZXMifSB9 | ||
``` | ||
AntonEliatra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Wrap this base64 encoded string in a `wrapper` query: | ||
|
||
```json | ||
POST /products/_search | ||
{ | ||
"query": { | ||
"wrapper": { | ||
"query": "eyAibWF0Y2giOiB7InRpdGxlIjogImhlYWRwaG9uZXMifSB9" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious as to where we decode this eventually? Also do we also need to mention here if any explicit plugin needs to be enabled to use this or basically any pre-requisite? @AntonEliatra There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sgup432 this comes with standard opensearch, no special plugins needed. I dont think we should start adding this clarification, because we would have to add that to everything that comes out of the box with OS. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is part of core OS functionality, we don't need to specify any prerequisites here. |
||
} | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
This executes the same query as the original `match` clause. |
Uh oh!
There was an error while loading. Please reload this page.