Hey folks, I’m building software that needs to be able to parse search and timeseries requests from Kibana. I started out by taking a dependency on org.opensearch:opensearch:2.1.0
so I could play tricks like this:
fun parseSearchSource(body: ObjectNode): SearchSourceBuilder {
val xp = XContentType.JSON.xContent()
.createParser(OpenSearchPluginRegistry.registry, DeprecationHandler.IGNORE_DEPRECATIONS, body.toString())
return SearchSourceBuilder.fromXContent(xp)
}
But now I’d like to be able to parse requests from future versions of Elasticsearch as well, specifically one that includes runtime_mappings
, which I know isn’t supported in OS. I don’t mind hand-writing Jackson codecs for most of these outer data types, but the Query DSL (i.e. the query
field in a SearchSource) specifically is a bear to parse, so if I can get away with it, I’d like to assume it’s changing less frequently, and continue to use OpenSearch’s hand-written parser to handle the Query DSL, but at the moment I’m having trouble isolating that functionality in a useful way.
The code that parses a QueryBuilder
from a StreamInput
seems simple enough but that appears to only work with Transport data, and I need to parse from JSON.
Any tips? Thanks!