client.ping returns error, but can access es in browser.
See original GitHub issueclient.ping()
returns error ResponseError: parsing_exception.
To Reproduce
'use strict'
const { Client } = require('@elastic/elasticsearch')
const client = new Client({ node: 'http://localhost:9200' })
client.ping({
requestTimeout: 20000,
}, function (error) {
if (error) {
console.error('Elasticsearch cluster is down!, ' + error);
} else {
console.log('Everything is ok');
}
});
Expected behavior
A successful connection. 😃
Notes
I can access the server by going to the url in the browser. Also, I’ve indexed a couple documents from node as well -code which ran after I get the error being discussed.
When running ./bin/elasticsearch, I get
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release. Version: 7.0.0, Build: default/tar/b7e28a7/2019-04-05T22:55:32.697037Z, JVM: 12
I’ve been trying various things, to no avail- adjusting timeout, ‘use strict’, ‘:9200/’, etc. At least I can still use REST. ^_^
Environment
- node version: 11.12.0
- npm: 6.7.0
- @elastic/elasticsearch version: 7.0.0-rc.1
- os: Mac High Siera 10.13.6
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Elastic search gives Bad request for ping - node.js
If I try adding new index, delete index, check the health or search, it works fine and gives the appropriate result. Can anyone...
Read more >How to Troubleshoot a Failed Ping Request | CBT Nuggets
If the nslookup utility fails to find the IP address(es) connected with a domain name, you know there's a problem with the DNS....
Read more >Can Ping Public IP But Can't Access Internet | USAT FAQs
If pinging IP addresses and domain names is successful while browsing the internet is not, try the following troubleshooting steps: Check the ...
Read more >elasticsearch.Client.ping JavaScript and Node.js code examples
client.ping({ // ping usually has a 3000ms timeout requestTimeout: Infinity, // undocumented params are appended to the query string hello: "elasticsearch!
Read more >Elasticsearch is running but it does not connect when the ...
Try again using https both in curl and in the browser to see if the error persists. spo ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello! In the new JavaScript client every option that is not intended for Elasticsearch lives in a second object, your code should be updated as follows:
In the
response
object other than body, statusCode, and headers, you will also find a warnings array and a meta object, which should help you debug issues. In this case, warnings contained the following message:'Client - Unknown parameter: "requestTimeout", sending it as query parameter'
.@delvedor Just checked and on my Elastic the exact name is
monitoring_user
.It worked !
Thx a lot for you quick and precise answer.