What is the java equivalent code for the following cURL command?
curl -XGET "http://localhost:9200/index1/type1/_search" -H 'Content-Type: application/json' -d'
{
"query": {
"match": {
"Tag": "Value1"
}
}
}'
I know how to do a Apache httpPost in java but how do I do httpGet with data?
I tried the following:
String jsonGet = "{"+
"\"query\": {" +
"\"match\": {"+
"\"Tag\": \"Value1\""+
"}"+
"}"+
"}";
HttpGet httpGet = new HttpGet("http://localhost:9200/index1/type1/_search?" + URLEncoder.encode(jsonGet,"UTF-8"));