Skip to content

Commit

Permalink
stdout logger with pelias-elasticsearch
Browse files Browse the repository at this point in the history
The legacy elasticsearch client had an integrated stdout logger.
The new elasticsearch client does not, so instead we use the
pelias-elasticsearch which integrates the modern elasticsearch client
with pelias-logger.
  • Loading branch information
michaelkirk committed Mar 11, 2024
1 parent a978bb5 commit b3109f3
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"dependencies": {
"@hapi/joi": "^16.1.8",
"colors": "^1.1.2",
"@elastic/elasticsearch": "~7.17.0",
"pelias-elasticsearch": "https://github.com/michaelkirk-pelias/pelias-elasticsearch#mkirk\/elastic8",
"glob": "^7.1.6",
"lodash": "^4.17.15",
"pelias-config": "https://github.com/michaelkirk-pelias/config#mkirk\/elastic8",
Expand Down
4 changes: 2 additions & 2 deletions scripts/check_plugins.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const colors = require('colors/safe');
const config = require('pelias-config').generate();
const es = require('@elastic/elasticsearch');
const client = new es.Client(config.esclient);
const buildClient = require('pelias-elasticsearch');
const client = buildClient(config.esclient);
const cli = require('./cli');

// mandatory plugins
Expand Down
4 changes: 2 additions & 2 deletions scripts/check_version.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const _ = require('lodash');
const semver = require('semver');
const es = require('@elastic/elasticsearch');
const buildClient = require('pelias-elasticsearch');
const config = require('pelias-config').generate();
const client = new es.Client(config.esclient);
const client = buildClient(config.esclient);
const cli = require('./cli');

// pass target elastic version semver as the first CLI arg
Expand Down
4 changes: 2 additions & 2 deletions scripts/create_index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const child_process = require('child_process');
const config = require('pelias-config').generate();
const es = require('@elastic/elasticsearch');
const buildClient = require('pelias-elasticsearch');
const SUPPORTED_ES_VERSIONS = '>=7.4.2';

const cli = require('./cli');
const schema = require('../schema');

cli.header("create index");

const client = new es.Client(config.esclient);
const client = buildClient(config.esclient);

// check minimum elasticsearch versions before continuing
try {
Expand Down
4 changes: 2 additions & 2 deletions scripts/drop_index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const colors = require('colors/safe');
const config = require('pelias-config').generate();
const es = require('@elastic/elasticsearch');
const client = new es.Client(config.esclient);
const buildClient = require('pelias-elasticsearch');
const client = buildClient(config.esclient);
const readline = require('readline');
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });

Expand Down
4 changes: 2 additions & 2 deletions scripts/info.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var config = require('pelias-config').generate().esclient;
var es = require('@elastic/elasticsearch');
var client = new es.Client(config);
var buildClient = require('pelias-elasticsearch');
var client = buildClient(config);

client.info( {}, console.log.bind(console) );
4 changes: 2 additions & 2 deletions scripts/update_settings.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var config = require('pelias-config').generate();
var es = require('@elastic/elasticsearch');
var client = new es.Client(config.esclient);
var buildClient = require('pelias-elasticsearch');
var client = buildClient(config.esclient);
var schema = require('../schema');

var _index = config.schema.indexName;
Expand Down
4 changes: 2 additions & 2 deletions test/elastictest/Suite.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const _ = require('lodash')
const randomstring = require('randomstring')
const elasticsearch = require('elasticsearch')
const buildClient = require('pelias-elasticsearch');
const async = require('async')

function Suite (clientOpts, props) {
Expand All @@ -26,7 +26,7 @@ Suite.prototype.assert = function (assert) {
}

Suite.prototype.start = function (cb) {
this.client = new elasticsearch.Client(this.clientOpts)
this.client = buildClient(this.clientOpts)
cb()
}

Expand Down

0 comments on commit b3109f3

Please sign in to comment.