Skip to content

[bugfix][plugin][elastcisearchreader] Fix ES query serialization and avoid adding type to search path#1379

Merged
wgzhao merged 1 commit intomasterfrom
esreader_bugfix
Nov 10, 2025
Merged

[bugfix][plugin][elastcisearchreader] Fix ES query serialization and avoid adding type to search path#1379
wgzhao merged 1 commit intomasterfrom
esreader_bugfix

Conversation

@wgzhao
Copy link
Owner

@wgzhao wgzhao commented Nov 10, 2025

Commit description Summary

  • Ensure the search request body sent to Elasticsearch is valid JSON and matches the user-provided search configuration.
  • Stop appending the legacy type segment into the search path (use /{index}/_search). This avoids incorrect pathing on ES 7+ where types are deprecated and can cause missed hits.
  • Add useful logging to help debug endpoint, query and failed responses.

Motivation

  • Previously ESKey.getQuery(...) used the configuration object’s toString() (or similar) which did not necessarily produce a valid ES JSON body. As a result, queries that worked with curl (sending raw JSON) returned no results when run through the plugin.
  • Some environments still supply type in configuration; adding type to the request path can result in requests to /index/type/_search, which is deprecated and may not route to the expected documents in newer ES versions. Removing type from the path and always using /{index}/_search makes behavior consistent with curl and modern ES.
    Extra logging helps confirm which endpoint is contacted and what JSON payload is being sent, and prints ES response details when a request fails.

…avoid adding type to search path

Ensure the search request body sent to Elasticsearch is valid JSON and matches the user-provided search configuration.
Stop appending the legacy type segment into the search path (use /{index}/_search). This avoids incorrect pathing on ES 7+ where types are deprecated and can cause missed hits.
Add useful logging to help debug endpoint, query and failed responses.
@wgzhao wgzhao merged commit 5bd62aa into master Nov 10, 2025
2 checks passed
@wgzhao wgzhao deleted the esreader_bugfix branch November 10, 2025 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant