Unable to add source engine to a meta-engine

Hi I'm trying to add a source-engine to my meta-engine but having this error

I'm using the version shown below.

    "@elastic/app-search-node": "^7.12.0",

Can anyone let me know what I'm doing wrong here.

Error: Not Found
    at Request._callback (/home/ctp/git/nodejs-backend/node_modules/@elastic/app-search-node/lib/client.js:95:26)
    at Request.self.callback (/home/ctp/git/nodejs-backend/node_modules/request/request.js:185:22)
    at Request.emit (node:events:527:28)
    at Request.<anonymous> (/home/ctp/git/nodejs-backend/node_modules/request/request.js:1154:10)
    at Request.emit (node:events:527:28)
    at IncomingMessage.<anonymous> (/home/ctp/git/nodejs-backend/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (node:events:641:28)
    at IncomingMessage.emit (node:events:539:35)
    at endReadableNT (node:internal/streams/readable:1345:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errorMessages: [ 'Not Found' ]

const AppSearchClient = require("@elastic/app-search-node");
const private_key = process.env.elastic_private_key;
const search_key = process.env.elastic_search_key;
const baseUrlFn = () => "  ";
const client = new AppSearchClient(undefined, private_key, baseUrlFn);

Here is my code.

const AppSearchClient = require("@elastic/app-search-node");
const private_key = process.env.elastic_private_key;
const search_key = process.env.elastic_search_key;
const baseUrlFn = () => "https://my-deployment-a685d4.kb.us-central1.gcp.cloud.es.io:9243/internal/app_search/engines";
const client = new AppSearchClient(undefined, private_key, baseUrlFn);

addSourceEng(metaName, source_engine) {
    client
      .addMetaEngineSources('all', [source_engine])

      .then((response) => console.log(response))
      .catch((error) => console.log(error))

  }


const baseUrlFn = () => "https://my-deployment-a685d4.kb.us-central1.gcp.cloud.es.io:9243/internal/app_search/engines";

This looks too long. If you navigate to the "Credentials" tab in the App Search UI it should give you the correct base URL to use here.

I'm guessing it would be:

https://my-deployment-a685d4.kb.us-central1.gcp.cloud.es.io:9243

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