Skip to content

Commit

Permalink
use 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 Jul 21, 2023
1 parent 307f4c2 commit e698faa
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 14 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
5 changes: 2 additions & 3 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 All @@ -20,7 +20,6 @@ function drop() {
// check all hosts to see if any is not localhost
function warnIfNotLocal() {
for (const idx in config.esclient.nodes) {
debugger;
const node = config.esclient.nodes[idx];
if (!node.includes('://localhost')) {
console.log(colors.red(`WARNING: DROPPING SCHEMA NOT ON LOCALHOST: ${node}`));
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

0 comments on commit e698faa

Please sign in to comment.