title: How should I do to make an elasticSearch , search query from Node.js correctly?
body: <p>I am stuck in a problem and can not figure out the solution.
  I want to use an elasticSearch query from my nodejs. 
  The problem is, I can make it work from postman, but not from node.</p>
  
  <pre><code>http://user:psd@my_domain:9200/ra_autocomplete/search
  </code></pre>
  
  <p>And from my nodejs app : </p>
  
  <pre><code>var elasticsearch = require('elasticsearch');
  var client = new elasticsearch.Client({
    host: 'my_domain',
    port : 9200,
    protocol : 'http',
    auth : 'user:psd',
    maxRetries : 2
  });
  </code></pre>
  
  <p>And then, </p>
  
  <pre><code>    client.search({
         index: "ra_autocomplete",
         body: {
           query: {
             m_prefix : {
             r_n : {
              query : my_var
            }
          }
        }
      }
    } , function(err, res) {
        console.log(err);
        console.log(res);
    });
  </code></pre>
  
  <p>I get this error : </p>
  
  <blockquote>
    <p>Error: Not Found
        at respond (my_path\node_modules\elasticsearch\src\lib\transport.js:307:15)
        at checkRespForFailure 
        (my_path\node_modules\elasticsearch\src\lib\transport.js:266:7)
        at HttpConnector. 
        (my_path\node_modules\elasticsearch\src\lib\connectors\http.js:159:7)
        at IncomingMessage.bound 
        (my_path\node_modules\lodash\dist\lodash.js:729:21)
        at emitNone (events.js:111:20)
        at IncomingMessage.emit (events.js:208:7)
        at endReadableNT (_stream_readable.js:1056:12)
        at _combinedTickCallback (internal/process/next_tick.js:138:11)
        at process._tickCallback (internal/process/next_tick.js:180:9)
      status: 404,
      displayName: 'NotFound',
      message: 'Not Found',
      path: '/roads_autocomplete/_search',
      query: {},
      body: '{"query":{"m_prefix":{"r_n":{"query":"montexte a analyser"}}}}',
      statusCode: 404,
      response: '\r\n404 Not Found\r\n\r\n<h1>404 Not Found</h1>\r\n<hr>nginx/1.10.3 (Ubuntu)\r\n\r\n\r\n',
      toString: [Function],
      toJSON: [Function] }</p>
  </blockquote>
  
  <p>Any help would be appreciated, the problem is, when I try to make it with postman, it goes well.</p>
  
  <p>Thank you.</p>