Skip to content

[Search][Fix] pass retriever query via body param instead of query in JS tutorial#237654

Merged
seialkali merged 1 commit intoelastic:mainfrom
seialkali:fix/js-search-index-code-example
Oct 7, 2025
Merged

[Search][Fix] pass retriever query via body param instead of query in JS tutorial#237654
seialkali merged 1 commit intoelastic:mainfrom
seialkali:fix/js-search-index-code-example

Conversation

@seialkali
Copy link
Contributor

@seialkali seialkali commented Oct 6, 2025

Summary

This PR fixes an issue where the retriever query copied from the "Search your data" JavaScript tutorial fails with a parsing_exception when passed via the query parameter in the Node.js Elasticsearch client. Retriever queries must be passed via the body parameter to ensure they are serialized correctly.

Screenshots

BEFORE

Screenshot 2025-10-06 at 14 33 13

AFTER

Screenshot 2025-10-06 at 14 35 20

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

Release Note

Fixes an issue where the retriever query copied from the "Search your data" JavaScript tutorial fails with a parsing_exception when passed via the query parameter in the Node.js Elasticsearch client. Retriever queries must be passed via the body parameter to ensure they are serialized correctly.

@seialkali seialkali requested a review from a team as a code owner October 6, 2025 13:37
@seialkali seialkali force-pushed the fix/js-search-index-code-example branch from 44ea56a to 52e3a58 Compare October 6, 2025 14:12
@seialkali seialkali force-pushed the fix/js-search-index-code-example branch from 52e3a58 to 98a8055 Compare October 7, 2025 08:20
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
searchIndices 202.2KB 202.2KB -2.0B

History

@seialkali seialkali merged commit c51ac9c into elastic:main Oct 7, 2025
12 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 9.1, 9.2

https://github.com/elastic/kibana/actions/runs/18312330567

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 7, 2025
… JS tutorial (elastic#237654)

## Summary

This PR fixes an issue where the retriever query copied from the "Search
your data" JavaScript tutorial fails with a `parsing_exception` when
passed via the query parameter in the Node.js Elasticsearch client.
Retriever queries must be passed via the body parameter to ensure they
are serialized correctly.

### Screenshots

**BEFORE**

<img width="700" alt="Screenshot 2025-10-06 at 14 33 13"
src="https://github.com/user-attachments/assets/46c33d73-2339-4047-917c-949e96b8a9b9"
/>

**AFTER**

<img width="700" alt="Screenshot 2025-10-06 at 14 35 20"
src="https://github.com/user-attachments/assets/c9e697f6-788c-43d9-b0a6-57746ade44f7"
/>

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [ ] ~Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)~
- [ ]
~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials~
- [ ] ~[Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios~
- [ ] ~If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~
- [ ] ~This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.~
- [ ] ~[Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed~
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

## Release Note

Fixes an issue where the retriever query copied from the "Search your
data" JavaScript tutorial fails with a `parsing_exception` when passed
via the query parameter in the Node.js Elasticsearch client. Retriever
queries must be passed via the body parameter to ensure they are
serialized correctly.

(cherry picked from commit c51ac9c)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 7, 2025
… JS tutorial (elastic#237654)

## Summary

This PR fixes an issue where the retriever query copied from the "Search
your data" JavaScript tutorial fails with a `parsing_exception` when
passed via the query parameter in the Node.js Elasticsearch client.
Retriever queries must be passed via the body parameter to ensure they
are serialized correctly.

### Screenshots

**BEFORE**

<img width="700" alt="Screenshot 2025-10-06 at 14 33 13"
src="https://github.com/user-attachments/assets/46c33d73-2339-4047-917c-949e96b8a9b9"
/>

**AFTER**

<img width="700" alt="Screenshot 2025-10-06 at 14 35 20"
src="https://github.com/user-attachments/assets/c9e697f6-788c-43d9-b0a6-57746ade44f7"
/>

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [ ] ~Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)~
- [ ]
~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials~
- [ ] ~[Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios~
- [ ] ~If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~
- [ ] ~This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.~
- [ ] ~[Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed~
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

## Release Note

Fixes an issue where the retriever query copied from the "Search your
data" JavaScript tutorial fails with a `parsing_exception` when passed
via the query parameter in the Node.js Elasticsearch client. Retriever
queries must be passed via the body parameter to ensure they are
serialized correctly.

(cherry picked from commit c51ac9c)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
9.1
9.2

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Oct 7, 2025
…ery in JS tutorial (#237654) (#237832)

# Backport

This will backport the following commits from `main` to `9.2`:
- [[Search][Fix] pass retriever query via body param instead of query in
JS tutorial (#237654)](#237654)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT
[{"author":{"name":"Brittany","email":"seialkali@gmail.com"},"sourceCommit":{"committedDate":"2025-10-07T12:16:53Z","message":"[Search][Fix]
pass retriever query via body param instead of query in JS tutorial
(#237654)\n\n## Summary\n\nThis PR fixes an issue where the retriever
query copied from the \"Search\nyour data\" JavaScript tutorial fails
with a `parsing_exception` when\npassed via the query parameter in the
Node.js Elasticsearch client.\nRetriever queries must be passed via the
body parameter to ensure they\nare serialized correctly.\n\n###
Screenshots\n\n**BEFORE**\n\n<img width=\"700\" alt=\"Screenshot
2025-10-06 at 14 33
13\"\nsrc=\"https://github.com/user-attachments/assets/46c33d73-2339-4047-917c-949e96b8a9b9\"\n/>\n\n**AFTER**\n\n<img
width=\"700\" alt=\"Screenshot 2025-10-06 at 14 35
20\"\nsrc=\"https://github.com/user-attachments/assets/c9e697f6-788c-43d9-b0a6-57746ade44f7\"\n/>\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [ ] ~Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)~\n-
[
]\n~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials~\n- [ ] ~[Unit
or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios~\n- [ ] ~If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~\n-
[ ] ~This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.~\n- [ ] ~[Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed~\n- [x] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n## Release Note\n\nFixes an
issue where the retriever query copied from the \"Search your\ndata\"
JavaScript tutorial fails with a `parsing_exception` when passed\nvia
the query parameter in the Node.js Elasticsearch client.
Retriever\nqueries must be passed via the body parameter to ensure they
are\nserialized
correctly.","sha":"c51ac9ceb377bf9b2a8b2c08b759ec2d519c432a","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Search","backport:version","v9.2.0","v9.3.0","v9.1.6"],"title":"[Search][Fix]
pass retriever query via body param instead of query in JS
tutorial","number":237654,"url":"https://github.com/elastic/kibana/pull/237654","mergeCommit":{"message":"[Search][Fix]
pass retriever query via body param instead of query in JS tutorial
(#237654)\n\n## Summary\n\nThis PR fixes an issue where the retriever
query copied from the \"Search\nyour data\" JavaScript tutorial fails
with a `parsing_exception` when\npassed via the query parameter in the
Node.js Elasticsearch client.\nRetriever queries must be passed via the
body parameter to ensure they\nare serialized correctly.\n\n###
Screenshots\n\n**BEFORE**\n\n<img width=\"700\" alt=\"Screenshot
2025-10-06 at 14 33
13\"\nsrc=\"https://github.com/user-attachments/assets/46c33d73-2339-4047-917c-949e96b8a9b9\"\n/>\n\n**AFTER**\n\n<img
width=\"700\" alt=\"Screenshot 2025-10-06 at 14 35
20\"\nsrc=\"https://github.com/user-attachments/assets/c9e697f6-788c-43d9-b0a6-57746ade44f7\"\n/>\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [ ] ~Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)~\n-
[
]\n~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials~\n- [ ] ~[Unit
or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios~\n- [ ] ~If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~\n-
[ ] ~This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.~\n- [ ] ~[Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed~\n- [x] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n## Release Note\n\nFixes an
issue where the retriever query copied from the \"Search your\ndata\"
JavaScript tutorial fails with a `parsing_exception` when passed\nvia
the query parameter in the Node.js Elasticsearch client.
Retriever\nqueries must be passed via the body parameter to ensure they
are\nserialized
correctly.","sha":"c51ac9ceb377bf9b2a8b2c08b759ec2d519c432a"}},"sourceBranch":"main","suggestedTargetBranches":["9.2","9.1"],"targetPullRequestStates":[{"branch":"9.2","label":"v9.2.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/237654","number":237654,"mergeCommit":{"message":"[Search][Fix]
pass retriever query via body param instead of query in JS tutorial
(#237654)\n\n## Summary\n\nThis PR fixes an issue where the retriever
query copied from the \"Search\nyour data\" JavaScript tutorial fails
with a `parsing_exception` when\npassed via the query parameter in the
Node.js Elasticsearch client.\nRetriever queries must be passed via the
body parameter to ensure they\nare serialized correctly.\n\n###
Screenshots\n\n**BEFORE**\n\n<img width=\"700\" alt=\"Screenshot
2025-10-06 at 14 33
13\"\nsrc=\"https://github.com/user-attachments/assets/46c33d73-2339-4047-917c-949e96b8a9b9\"\n/>\n\n**AFTER**\n\n<img
width=\"700\" alt=\"Screenshot 2025-10-06 at 14 35
20\"\nsrc=\"https://github.com/user-attachments/assets/c9e697f6-788c-43d9-b0a6-57746ade44f7\"\n/>\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [ ] ~Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)~\n-
[
]\n~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials~\n- [ ] ~[Unit
or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios~\n- [ ] ~If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~\n-
[ ] ~This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.~\n- [ ] ~[Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed~\n- [x] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n## Release Note\n\nFixes an
issue where the retriever query copied from the \"Search your\ndata\"
JavaScript tutorial fails with a `parsing_exception` when passed\nvia
the query parameter in the Node.js Elasticsearch client.
Retriever\nqueries must be passed via the body parameter to ensure they
are\nserialized
correctly.","sha":"c51ac9ceb377bf9b2a8b2c08b759ec2d519c432a"}},{"branch":"9.1","label":"v9.1.6","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Brittany <seialkali@gmail.com>
kibanamachine added a commit that referenced this pull request Oct 7, 2025
…ery in JS tutorial (#237654) (#237831)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[Search][Fix] pass retriever query via body param instead of query in
JS tutorial (#237654)](#237654)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT
[{"author":{"name":"Brittany","email":"seialkali@gmail.com"},"sourceCommit":{"committedDate":"2025-10-07T12:16:53Z","message":"[Search][Fix]
pass retriever query via body param instead of query in JS tutorial
(#237654)\n\n## Summary\n\nThis PR fixes an issue where the retriever
query copied from the \"Search\nyour data\" JavaScript tutorial fails
with a `parsing_exception` when\npassed via the query parameter in the
Node.js Elasticsearch client.\nRetriever queries must be passed via the
body parameter to ensure they\nare serialized correctly.\n\n###
Screenshots\n\n**BEFORE**\n\n<img width=\"700\" alt=\"Screenshot
2025-10-06 at 14 33
13\"\nsrc=\"https://github.com/user-attachments/assets/46c33d73-2339-4047-917c-949e96b8a9b9\"\n/>\n\n**AFTER**\n\n<img
width=\"700\" alt=\"Screenshot 2025-10-06 at 14 35
20\"\nsrc=\"https://github.com/user-attachments/assets/c9e697f6-788c-43d9-b0a6-57746ade44f7\"\n/>\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [ ] ~Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)~\n-
[
]\n~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials~\n- [ ] ~[Unit
or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios~\n- [ ] ~If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~\n-
[ ] ~This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.~\n- [ ] ~[Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed~\n- [x] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n## Release Note\n\nFixes an
issue where the retriever query copied from the \"Search your\ndata\"
JavaScript tutorial fails with a `parsing_exception` when passed\nvia
the query parameter in the Node.js Elasticsearch client.
Retriever\nqueries must be passed via the body parameter to ensure they
are\nserialized
correctly.","sha":"c51ac9ceb377bf9b2a8b2c08b759ec2d519c432a","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Search","backport:version","v9.2.0","v9.3.0","v9.1.6"],"title":"[Search][Fix]
pass retriever query via body param instead of query in JS
tutorial","number":237654,"url":"https://github.com/elastic/kibana/pull/237654","mergeCommit":{"message":"[Search][Fix]
pass retriever query via body param instead of query in JS tutorial
(#237654)\n\n## Summary\n\nThis PR fixes an issue where the retriever
query copied from the \"Search\nyour data\" JavaScript tutorial fails
with a `parsing_exception` when\npassed via the query parameter in the
Node.js Elasticsearch client.\nRetriever queries must be passed via the
body parameter to ensure they\nare serialized correctly.\n\n###
Screenshots\n\n**BEFORE**\n\n<img width=\"700\" alt=\"Screenshot
2025-10-06 at 14 33
13\"\nsrc=\"https://github.com/user-attachments/assets/46c33d73-2339-4047-917c-949e96b8a9b9\"\n/>\n\n**AFTER**\n\n<img
width=\"700\" alt=\"Screenshot 2025-10-06 at 14 35
20\"\nsrc=\"https://github.com/user-attachments/assets/c9e697f6-788c-43d9-b0a6-57746ade44f7\"\n/>\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [ ] ~Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)~\n-
[
]\n~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials~\n- [ ] ~[Unit
or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios~\n- [ ] ~If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~\n-
[ ] ~This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.~\n- [ ] ~[Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed~\n- [x] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n## Release Note\n\nFixes an
issue where the retriever query copied from the \"Search your\ndata\"
JavaScript tutorial fails with a `parsing_exception` when passed\nvia
the query parameter in the Node.js Elasticsearch client.
Retriever\nqueries must be passed via the body parameter to ensure they
are\nserialized
correctly.","sha":"c51ac9ceb377bf9b2a8b2c08b759ec2d519c432a"}},"sourceBranch":"main","suggestedTargetBranches":["9.2","9.1"],"targetPullRequestStates":[{"branch":"9.2","label":"v9.2.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/237654","number":237654,"mergeCommit":{"message":"[Search][Fix]
pass retriever query via body param instead of query in JS tutorial
(#237654)\n\n## Summary\n\nThis PR fixes an issue where the retriever
query copied from the \"Search\nyour data\" JavaScript tutorial fails
with a `parsing_exception` when\npassed via the query parameter in the
Node.js Elasticsearch client.\nRetriever queries must be passed via the
body parameter to ensure they\nare serialized correctly.\n\n###
Screenshots\n\n**BEFORE**\n\n<img width=\"700\" alt=\"Screenshot
2025-10-06 at 14 33
13\"\nsrc=\"https://github.com/user-attachments/assets/46c33d73-2339-4047-917c-949e96b8a9b9\"\n/>\n\n**AFTER**\n\n<img
width=\"700\" alt=\"Screenshot 2025-10-06 at 14 35
20\"\nsrc=\"https://github.com/user-attachments/assets/c9e697f6-788c-43d9-b0a6-57746ade44f7\"\n/>\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [ ] ~Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)~\n-
[
]\n~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials~\n- [ ] ~[Unit
or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios~\n- [ ] ~If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~\n-
[ ] ~This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.~\n- [ ] ~[Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed~\n- [x] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n## Release Note\n\nFixes an
issue where the retriever query copied from the \"Search your\ndata\"
JavaScript tutorial fails with a `parsing_exception` when passed\nvia
the query parameter in the Node.js Elasticsearch client.
Retriever\nqueries must be passed via the body parameter to ensure they
are\nserialized
correctly.","sha":"c51ac9ceb377bf9b2a8b2c08b759ec2d519c432a"}},{"branch":"9.1","label":"v9.1.6","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Brittany <seialkali@gmail.com>
rylnd pushed a commit to rylnd/kibana that referenced this pull request Oct 17, 2025
… JS tutorial (elastic#237654)

## Summary

This PR fixes an issue where the retriever query copied from the "Search
your data" JavaScript tutorial fails with a `parsing_exception` when
passed via the query parameter in the Node.js Elasticsearch client.
Retriever queries must be passed via the body parameter to ensure they
are serialized correctly.

### Screenshots

**BEFORE**

<img width="700" alt="Screenshot 2025-10-06 at 14 33 13"
src="https://github.com/user-attachments/assets/46c33d73-2339-4047-917c-949e96b8a9b9"
/>

**AFTER**

<img width="700" alt="Screenshot 2025-10-06 at 14 35 20"
src="https://github.com/user-attachments/assets/c9e697f6-788c-43d9-b0a6-57746ade44f7"
/>

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] ~Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)~
- [ ]
~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials~
- [ ] ~[Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios~
- [ ] ~If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~
- [ ] ~This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.~
- [ ] ~[Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed~
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

## Release Note

Fixes an issue where the retriever query copied from the "Search your
data" JavaScript tutorial fails with a `parsing_exception` when passed
via the query parameter in the Node.js Elasticsearch client. Retriever
queries must be passed via the body parameter to ensure they are
serialized correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment