<commit_before>var elasticsearch = require('elasticsearch');
var es = new elasticsearch.Client({
    hosts: [ 'es-1.weave.local:9200', 'es-2.weave.local:9200', 'es-3.weave.local:9200', ],
      log: 'trace'
});

var restify = require('restify');

var server = restify.createServer({
  name: 'Hello, ElasticSearch on Weave!',
});

server.use(restify.bodyParser({ mapParams: false }));

server.listen(80);

es.ping({
  requestTimeout: 1000,
  // undocumented params are appended to the query string
  hello: "elasticsearch!"
}, function (error) {
  if (error) {
    console.error('elasticsearch cluster is down!');
  } else {
    console.log('All is well');
  }
});

es.indices.create({
  index: "hello",
}, function (error) {
  if (error) {
   console.error(error.message);
  } else {
   console.log('Created an index for our app.');
  }
});

server.get('/', function (req, res, next) {
  es.nodes.info({
    human: true,
    metrics: [ 'host', 'ip' ],
  }, function (error, es_res) {
    if (error) {
      res.send(500, { msg: error.message });
    } else {
    //res.send(200, { msg: "ElasticSearch cluster has _ nodes and all are well!" });
      res.send(200, es_res);
    }
  });
  return next();
});

server.post('/hello/:name', function (req, res, next) {
  es.create({
    index: 'hello',
    type: 'json',
    //id: 'h1',
    body: {
      title: req.params.name,
      published: true,
      text: req.body,
    },
  }, function (error, es_res) {
    if (error) {
      res.send(500, { msg: error.message });
    } else {
      res.send(201, { msg: server_res });
    }
  });
  return next();
});
<commit_msg>Fix typo<commit_after>var elasticsearch = require('elasticsearch');
var es = new elasticsearch.Client({
    hosts: [ 'es-1.weave.local:9200', 'es-2.weave.local:9200', 'es-3.weave.local:9200', ],
      log: 'trace'
});

var restify = require('restify');

var server = restify.createServer({
  name: 'Hello, ElasticSearch on Weave!',
});

server.use(restify.bodyParser({ mapParams: false }));

server.listen(80);

es.ping({
  requestTimeout: 1000,
  // undocumented params are appended to the query string
  hello: "elasticsearch!"
}, function (error) {
  if (error) {
    console.error('elasticsearch cluster is down!');
  } else {
    console.log('All is well');
  }
});

es.indices.create({
  index: "hello",
}, function (error) {
  if (error) {
   console.error(error.message);
  } else {
   console.log('Created an index for our app.');
  }
});

server.get('/', function (req, res, next) {
  es.nodes.info({
    human: true,
    metrics: [ 'host', 'ip' ],
  }, function (error, es_res) {
    if (error) {
      res.send(500, { msg: error.message });
    } else {
    //res.send(200, { msg: "ElasticSearch cluster has _ nodes and all are well!" });
      res.send(200, es_res);
    }
  });
  return next();
});

server.post('/hello/:name', function (req, res, next) {
  es.create({
    index: 'hello',
    type: 'json',
    //id: 'h1',
    body: {
      title: req.params.name,
      published: true,
      text: req.body,
    },
  }, function (error, es_res) {
    if (error) {
      res.send(500, { msg: error.message });
    } else {
      res.send(201, { msg: es_res });
    }
  });
  return next();
});

{'fraction_non_alphanumeric': 0.1882935893465469, 'fraction_numerical': 0.022917311861257356, 'mean_word_length': 2.977832512315271, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1064324', 'n_tokens_mistral': 1179, 'n_tokens_neox': 1140, 'n_words': 271}