Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (19.1k points)

I'm using the elasticsearch API for node.js to make the following query to aws elasticsearch.

The elasticsearch documentation says that the request body search uses the GET method.

I'm using Wireshark to look at the request send by my application with the body search method and I see that the method used is a POST.


Why is sending a POST? I want to allow only GET request to my domain.


var elasticsearch = require('elasticsearch');

var AWS = require('aws-sdk');

AWS.config.update({ region: 'eu-central-1' });

var elasticClient = elasticsearch.Client({

  hosts: [ 'host' ],

  connectionClass: require('http-aws-es'),

  log: ['error', 'warning'],

    amazonES: {

        region: 'eu-central-1',

        accessKey: 'accessKey',

        secretKey: 'secretKey'



var indexName = "indexName";

var type = "records";

    function querySearch(data){

        console.log("[INFO]: Check data "+JSON.stringify(data));


            index: indexName,

            type: type,

            body:  data



    exports.querySearch = querySearch; 


var elastic = require('./elasticsearch.js');

    elastic.querySearch({"query": {"bool": {"must": [{ "match": { "id": "value" } }]}}}).then(function (resp) {

        //If data doesn't exist in elasticsearch insert into Firehose

        if (resp.hits.hits.length == 0){

            console.log("[INFO]: No data");


            console.log("[INFO]: Record already in Elasticsearch");


    }, function (err) {

        console.trace("[ERROR]: "+err.message);


1 Answer

0 votes
by (44.4k points)

You can simply do this: = ca({

  params: {

    includeTypeName: {

      type: 'string',

      name: 'include_type_name'



    method: 'POST'


Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
asked Jul 18, 2019 in AWS by yuvraj (19.1k points)

Browse Categories