Skip to content

apiVersion - Can not found Elastic version 5.0 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jpabbuehl opened this issue May 2, 2017 · 6 comments
Closed

apiVersion - Can not found Elastic version 5.0 #1

jpabbuehl opened this issue May 2, 2017 · 6 comments

Comments

@jpabbuehl
Copy link

jpabbuehl commented May 2, 2017

Hi

I am trying to use this module with my local ES cluster (5.0)
I get this error with your example:

/home/jp/react-projects/home_server/node_modules/graphql-compose-elasticsearch/lib/ElasticApiParser.js:317
  throw new Error(`Can not found Elastic version '${version}' in ${apiListFile}`);

Error: Can not found Elastic version '5.0' in /home/jp/react-projects/home_server/node_modules/elasticsearch/src/lib/apis/index.js

at this line

In composeWithElastic({

  elasticClient: new elasticsearch.Client({host: 'http://localhost:9200', apiVersion: '5.0', log: 'trace'})
});

Instead when I use directly the elasticsearch module and the following example, it works.

import elasticsearch from 'elasticsearch';
var client = new elasticsearch.Client({
  host: 'localhost:9200',
  apiVersion: '5.0',
  log: 'trace'
});

client.ping({
  requestTimeout: 30000,
}, function (error) {
  if (error) {
  console.error('elasticsearch cluster is down!');
  } else {
  console.log('All is well');
  }
});

Is there anything wrong with ElasticApiParser.js in your module (probably not :) ?
What I am doing wrong ? BTW I am under ubuntu 16.10
Best

JP

@nodkz
Copy link
Member

nodkz commented May 2, 2017

Internally graphql-compose-elasticsearch parses elasticsearch files for generating proper and fully compatible GraphQL API wrapper.

Please run in terminal

# getting avaliable API's versions
cat /home/jp/react-projects/home_server/node_modules/elasticsearch/src/lib/apis/index.js

# getting elasticsearch version
cat /home/jp/react-projects/home_server/node_modules/elasticsearch/package.json

and provide here output.

Suppose that your elasticsearch module does not contain 5.0 version and use as fallback 5.x or _default.

@jpabbuehl
Copy link
Author

jpabbuehl commented May 2, 2017

cat /home/jp/react-projects/home_server/node_modules/elasticsearch/src/lib/apis/index.js

module.exports = {
  get '_default'() { return require('./5_3'); },
  get '5.3'() { return require('./5_3'); },
  get '5.2'() { return require('./5_2'); },
  get '5.1'() { return require('./5_1'); },
  get '5.0'() { return require('./5_0'); },
  get '2.4'() { return require('./2_4'); },
  get '1.7'() { return require('./1_7'); },
  get '0.90'() { return require('./0_90'); },
  get '5.x'() { return require('./5_x'); },
  get 'master'() { return require('./master'); },
};

cat /home/jp/react-projects/home_server/node_modules/elasticsearch/package.json

{
  "_args": [
    [
      {
        "raw": "elasticsearch@^13.0.0",
        "scope": null,
        "escapedName": "elasticsearch",
        "name": "elasticsearch",
        "rawSpec": "^13.0.0",
        "spec": ">=13.0.0 <14.0.0",
        "type": "range"
      },
      "/home/jp/react-projects/home_server"
    ]
  ],
  "_from": "elasticsearch@>=13.0.0 <14.0.0",
  "_id": "[email protected]",
  "_inCache": true,
  "_location": "/elasticsearch",
  "_nodeVersion": "6.10.2",
  "_npmOperationalInternal": {
    "host": "packages-18-east.internal.npmjs.com",
    "tmp": "tmp/elasticsearch-13.0.0.tgz_1493055268283_0.3476285405922681"
  },
  "_npmUser": {
    "name": "spalger",
    "email": "[email protected]"
  },
  "_npmVersion": "3.10.10",
  "_phantomChildren": {},
  "_requested": {
    "raw": "elasticsearch@^13.0.0",
    "scope": null,
    "escapedName": "elasticsearch",
    "name": "elasticsearch",
    "rawSpec": "^13.0.0",
    "spec": ">=13.0.0 <14.0.0",
    "type": "range"
  },
  "_requiredBy": [
    "#USER",
    "/"
  ],
  "_resolved": "https://registry.npmjs.org/elasticsearch/-/elasticsearch-13.0.0.tgz",
  "_shasum": "7f95bdbff5cad637a53be613ddb9adf3770cef58",
  "_shrinkwrap": null,
  "_spec": "elasticsearch@^13.0.0",
  "_where": "/home/jp/react-projects/home_server",
  "author": {
    "name": "Spencer Alger"
  },
  "browser": {
    "./src/lib/connectors/index.js": "./src/lib/connectors/browser_index.js",
    "./src/lib/loggers/index.js": "./src/lib/loggers/browser_index.js",
    "./src/lib/apis/index.js": "./src/lib/apis/browser_index.js",
    "./test/mocks/server.js": "./test/mocks/browser_server.js"
  },
  "bugs": {
    "url": "https://github.com/elastic/elasticsearch-js/issues"
  },
  "config": {
    "blanket": {
      "pattern": "specified in test/unit/coverage.js"
    },
    "default_api_branch": "5.3",
    "supported_es_branches": [
      "5.3",
      "5.2",
      "5.1",
      "5.0",
      "2.4",
      "1.7",
      "0.90"
    ],
    "unstable_es_branches": [
      "5.x",
      "master"
    ]
  },
  "dependencies": {
    "agentkeepalive": "^2.2.0",
    "chalk": "^1.0.0",
    "lodash": "2.4.2",
    "lodash.get": "^4.4.2",
    "lodash.isempty": "^4.4.0",
    "lodash.trimend": "^4.5.1"
  },
  "description": "The official low-level Elasticsearch client for Node.js and the browser.",
  "devDependencies": {
    "@spalger/eslint-config-personal": "^0.4.0",
    "async": "~0.8.0",
    "babel-eslint": "^6.0.4",
    "blanket": "^1.2.3",
    "bluebird": "^2.9.14",
    "eslint": "^2.9.0",
    "eslint-config-airbnb": "^8.0.0",
    "eslint-plugin-import": "^1.6.1",
    "eslint-plugin-jsx-a11y": "^1.0.4",
    "eslint-plugin-react": "^5.0.1",
    "expect.js": "^0.3.1",
    "express": "~3.4.7",
    "find-root": "~0.1.1",
    "glob": "~3.2.7",
    "grunt": "^1.0.1",
    "grunt-cli": "^1.2.0",
    "grunt-contrib-clean": "^1.0.0",
    "grunt-contrib-compress": "^1.2.0",
    "grunt-contrib-concat": "^1.0.1",
    "grunt-contrib-copy": "^1.0.0",
    "grunt-contrib-uglify": "^1.0.1",
    "grunt-contrib-watch": "^1.0.0",
    "grunt-esvm": "^3.2.8",
    "grunt-mocha-cov": "^0.4.0",
    "grunt-open": "~0.2.2",
    "grunt-prompt": "^1.3.3",
    "grunt-run": "^0.6.0",
    "grunt-s3": "~0.2.0-alpha.3",
    "grunt-saucelabs": "^8.6.2",
    "grunt-webpack": "^1.0.11",
    "jquery": "^2.2.3",
    "js-yaml": "^3.6.0",
    "load-grunt-config": "^0.19.2",
    "load-grunt-tasks": "^3.5.0",
    "mocha": "^2.2.5",
    "mocha-lcov-reporter": "0.0.1",
    "mocha-screencast-reporter": "~0.1.4",
    "moment": "^2.13.0",
    "nock": "~0.28.3",
    "null-loader": "^0.1.1",
    "open": "0.0.5",
    "optimist": "~0.6.0",
    "semver": "^4.3.6",
    "sinon": "^1.17.4",
    "split": "~0.3.2",
    "through2": "~0.6.3",
    "through2-map": "~1.4.0",
    "webpack": "^1.13.0",
    "webpack-dev-server": "^1.14.1",
    "xmlbuilder": "~0.4.3"
  },
  "directories": {},
  "dist": {
    "shasum": "7f95bdbff5cad637a53be613ddb9adf3770cef58",
    "tarball": "https://registry.npmjs.org/elasticsearch/-/elasticsearch-13.0.0.tgz"
  },
  "engines": {
    "node": ">=0.8"
  },
  "gitHead": "5e9afef1ad964ea7c64ab9de8a33937cb359cf09",
  "homepage": "http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html",
  "keywords": [
    "elasticsearch",
    "mapping",
    "REST"
  ],
  "license": "Apache-2.0",
  "main": "src/elasticsearch.js",
  "maintainers": [
    {
      "name": "lukasolson",
      "email": "[email protected]"
    },
    {
      "name": "spalger",
      "email": "[email protected]"
    },
    {
      "name": "tylersmalley",
      "email": "[email protected]"
    }
  ],
  "name": "elasticsearch",
  "optionalDependencies": {},
  "readme": "ERROR: No README data found!",
  "repository": {
    "type": "git",
    "url": "git+ssh://[email protected]/elastic/elasticsearch-js.git"
  },
  "scripts": {
    "eslint": "eslint src scripts test grunt Gruntfile.js",
    "generate": "node scripts/generate",
    "grunt": "grunt",
    "test": "grunt test"
  },
  "version": "13.0.0"
}

@nodkz
Copy link
Member

nodkz commented May 2, 2017

Khm. Very strange. Will review it later.

For now as a fallback, you may use this option elasticApiFilePath:

composeWithElastic({
  elasticApiFilePath: '/home/jp/react-projects/home_server/node_modules/elasticsearch/src/lib/apis/5_0.js', // or provide relative path
  elasticClient: new elasticsearch.Client({host: 'http://localhost:9200', apiVersion: '5.0', log: 'trace'})
});

@jpabbuehl
Copy link
Author

jpabbuehl commented May 2, 2017

thank you for your help and your nice work 👍
edit: sorry, it does not solve this issue. It's strange, if I git clone your repos, that's working fine. But when getting module from npm, it doesn't.

@jpabbuehl
Copy link
Author

Ok the issue comes from [email protected] installed via npm.
With [email protected], everything is running fine.

@nodkz nodkz closed this as completed in be31a39 May 2, 2017
@nodkz
Copy link
Member

nodkz commented May 2, 2017

New version will be published from minute to minute.
Please try it without elasticApiFilePath option with [email protected] module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants