elasticsearch-js-mock icon indicating copy to clipboard operation
elasticsearch-js-mock copied to clipboard

ProductNotSupportedError for elasticsearch-js-mock >=v0.3.1 <=1.0.0 and @elasticsearch/elasticsearch >7.13.0 <= 7.17.0

Open iacondios opened this issue 1 year ago • 0 comments

We have a set of Elasticsearch client unit tests which make use of the mock interface. These tests were previously working using elasticsearch-js-mock v0.3.1 and an old version of Elasticsearchclient 7.6.1. Upon upgrading to the latest ES client 7.17, we also brought up the mock version to 1.0.0 (as it says it works with ES 7 clients). However, this causes the error:

ProductNotSupportedError: The client noticed that the server is not Elasticsearch and we do not support this unknown product.

to appear when the client getMapping endpoint is called. Further investigation shows that this error occurs for both elasticsearch-js-mock v0.3.1 and v1.0.0, with all elasticsearch 7 clients greater than 7.13.0. It appears that this problem was addressed a while ago for earlier versions of Elasticsearch, and thus 0.3.1 was born; could something have happened to break this version check with the latest versions of the Elasticsearchclient?

Full stack trace: ` ProductNotSupportedError: The client noticed that the server is not Elasticsearch and we do not support this unknown product.

  75 | function getMappingFromElastic(params) {
  76 |     return __awaiter(this, void 0, void 0, function* () {
> 77 |         return client.indices.getMapping(params);
     |                               ^
  78 |     });
  79 | }
  80 | exports.getMappingFromElastic = getMappingFromElastic;

  at Transport.request (node_modules/@elastic/elasticsearch/lib/Transport.js:477:19)
  at IndicesApi.indicesGetMappingApi [as getMapping] (node_modules/@elastic/elasticsearch/api/api/indices.js:845:25)
  at getMapping (build/elasticsearch/elasticsearchClient.js:77:31)
  at next (build/elasticsearch/elasticsearchClient.js:8:71)
  at Object.<anonymous>.__awaiter (build/elasticsearch/elasticsearchClient.js:4:12)
  at __awaiter (build/elasticsearch/elasticsearchClient.js:76:12)
  at ElasticsearchMappingHelper.<anonymous> (build/elasticsearch/elasticsearchMappingHelper.js:35:83)
  at next (build/elasticsearch/elasticsearchMappingHelper.js:8:71)
  at Object.<anonymous>.__awaiter (build/elasticsearch/elasticsearchMappingHelper.js:4:12)
  at ElasticsearchMappingHelper.__awaiter [as getFieldNames] (build/elasticsearch/elasticsearchMappingHelper.js:29:16)
  at getFieldNames (build/elasticsearch/__testing__/elasticsearchMappingHelper.test.js:43:24)
  at next (build/elasticsearch/__testing__/elasticsearchMappingHelper.test.js:8:71)
  at Object.<anonymous>.__awaiter (build/elasticsearch/__testing__/elasticsearchMappingHelper.test.js:4:12)
  at Object.__awaiter (build/elasticsearch/__testing__/elasticsearchMappingHelper.test.js:42:40)

`

iacondios avatar Jun 14 '23 01:06 iacondios