Types in Opensearch JS Client

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):

@opensearch-project/opensearch": “^2.4.0”

Describe the issue:

We have recently migrated from Elasticsearch to Opensearch. We have substituted @elastic/elasticsearch for @opensearch-project/opensearch.

Since some of our queries are quite complex, we have made use of the types provided by @elastic/elasticsearch so they can be checked by TypeScript.

I am not sure if I understand the opensearch client types correctly. The query’s body just seems to be an object with string keys Record<string, any>, see opensearch-js/api/requestParams.d.ts at 4da9a4bacca35a23e3f5b0616762c8de7f763fdb · opensearch-project/opensearch-js · GitHub
So there are no checks if a property actually exists.

Looking at the interface Search, I am a bit confused since I put the whole query (including from, size etc.) in body but there are properties like from and size on the same level as body, see opensearch-js/api/requestParams.d.ts at 4da9a4bacca35a23e3f5b0616762c8de7f763fdb · opensearch-project/opensearch-js · GitHub .

Has anyone recently made the same migration and would share the experience made?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.