Skip to content

Python code works, Node.js not. Why? ES AWS #61

@falent

Description

@falent

I am totally shocked why my code in node.js doesnt work and with python works like a charm? It is so weird for me :( Could someone take a look please and tell me what I am doing wrong?

Python code:

from elasticsearch import Elasticsearch
import json
esclient = Elasticsearch(['https://61699**.eu-central-1.aws.cloud.es.io/recipes/'],
http_auth=('d**', 'e.**'), scheme="https")

response = esclient.search(index="", body=json.dumps({"query": {"match": {'Title':'Easter Bunny Cupcakes'}}}))
    
print response

Node.js code:

const elasticsearch = require('elasticsearch');
const AWS = require('aws-sdk');

const client = elasticsearch.Client({
  hosts: ''61699**.eu-central-1.aws.cloud.es.io/recipes/',
  connectionClass: require('http-aws-es'),
  amazonES: {
    accessKey: 'd**',
    secretKey: 'e.**',
  },
  awsConfig: new AWS.Config({region: 'eu-central-1'}),
});


client.index({
  index: '',
  type: '_doc',
  body: {
    query: {
      match: {
        Title: 'Easter Bunny Cupcakes',
      },
    },
  },
}, function(err, data) {
  console.log(err);
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions