aquasecurity / aquasecurity/esquery
Consider support/compatibilty for Opensearch
- Dominant language
- Go
- Stars
- 317
- Forks
- 58
- PR merge metrics
- No merged PRs in 30d
Description
This library currently depends on go-elasticsearch to implement some of the Search functionality. Without getting into a discussion on the opensearch/elasticsearch fork, what this libary accomplishes with the the query builder component is amazing! Makes writing queries so much better.
As a user of opensearch, I'd like to be able to continue to use esquery's Query builder.
Currently while I can accomplish this (code below) I suspect later updates may break it. I'd like to open a discussion on potentially maintaining this feature. I noticed Query returns a full Search object when it's marshaled into JSON, currently this seems to be overridden by the opensearch client/backend. But it'd be great if the integration was a bit cleaner.
```
client, err := opensearch.NewDefaultClient()
query := esquery.Query(
esquery.Bool().
Filter(
esquery.Range("@timestamp").Gt("now"),
)
)
searchResponse, err := client.Search(
client.Search.WithContext(ctx),
client.Search.WithIndex("foo"),
client.Search.WithBody(opensearchutil.NewJSONReader(&query)),
client.Search.WithSort("@timestamp:asc"),
)
```
Thank you for such a great library.
Contributor guide
Research direction
Start with esquery.Query, its JSON marshaling behavior, and the go-elasticsearch dependency described in the issue. Compare that integration with the shown OpenSearch client usage and clarify the supported compatibility boundary; done means an agreed, maintained integration path rather than an ad hoc workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elasticsearch, go
- Domain
- backend, search
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100