RuntimeTools / appmetrics-elk

A connector that collects data using 'appmetrics' and sends it to ElasticSearch for use with Kibana
Apache License 2.0
29 stars 12 forks source link

TypeError: esearch.searchExists is not a function #23

Open alexanderjsx opened 7 years ago

alexanderjsx commented 7 years ago

Getting Type error on fresh installation:

    at Object.monitor (/Users/ajakoba/KWIFF_REPOS/core/core-logging/node_modules/appmetrics-elk/lib/appmetrics-elk.js:70:13)
    at Object.<anonymous> (/Users/ajakoba/KWIFF_REPOS/core/core-logging/index.js:2:27)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)
    at node.js:974:3

elasticsearch node module version installed with the library is 12.1.3 elasticsearch server version 5.1.1 node version v4.6.1

seabaylea commented 7 years ago

It looks like the searchExists() API was removed in the easticsearch.js 5.0 API update.

As a workaround, you should be able to request the 2.4 API using the apiVersion field in the Elasticsearch config object you pass to the monitor() API of appmetrics-elk, eg.

var config = {
    apiVersion = '2.4'
}
var appmetrics = require('appmetrics-elk').monitor(config); 
arjanvanderleden commented 7 years ago

Solution of @seabaylea works for me

imvishalsingh commented 7 years ago

[Mon Aug 21 18:08:45 2017] com.ibm.diagnostics.healthcenter.loader INFO: Node Application Metrics 1.2.0.201612012154 (Agent Core 3.1.0) [Mon Aug 21 18:08:45 2017] com.ibm.diagnostics.healthcenter.mqtt INFO: Connecting to broker localhost:1883 /project/academic/node_modules/appmetrics-elk/lib/appmetrics-elk.js:70 esearch.searchExists({ ^

TypeError: esearch.searchExists is not a function at Object.monitor (/project/academic/node_modules/appmetrics-elk/lib/appmetrics-elk.js:70:13) at Object. (/project/academic/app.js:31:44) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9)

node -version: 6.10 elastic server -varsion: 5.5

I try above api version but it not working, help me

imvishalsingh commented 7 years ago

var config = { host: 'http://172.28.49.13:9200', apiVersion: 2.4 } var appmetrics = require('appmetrics-elk').monitor(); appmetrics.disable('mysql'); // disable MySQL monitoring

ggb667 commented 6 years ago

I updated package.json to: "appmetrics": "^3.0.0", "elasticsearch": "13.3.1"

This work around no longer works apparently. Maybe apiVersion can't go back that far? Any ideas?