In this ElasticSearch document it explains how to submit a query:
GET /_search
{
"query": {
"match" : {
"message" : "this is a test"
}
}
}
But a GET doesn't have a body, it's just a link to get a document.
The related CURL in the documentation:
curl -X GET "localhost:9200/_search" -H 'Content-Type: application/json' -d'
{
"query": {
"match" : {
"message" : "this is a test"
}
}
}
'
If I read the meaning of -d
in CURL documentation, it says
-d, --data
(HTTP) Sends the specified data in a POST request to the HTTP server, in the same way that a browser does when a user has filled in an HTML form and presses the submit button.
Meaning that the GET should be converted to a POST? I'm confused, from a Java program do I need to submit a GET or a POST to the ElasticSearch engine?