有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!


共 (1) 个答案

  1. # 1 楼答案

    您可以通过以下方式轻松实现:

    StringRequestEntity entity = new StringRequestEntity(
        "{\"id\":\"contact\", \"params\": {\"q\": \"123456\", \"company\": \"2\"}}",
        "application/json",
        "UTF-8");
    
    PostMethod post = new PostMethod("http://localhost:9200/contact/_search/template");
    postMethod.addParameter("pretty", "");
    postMethod.setRequestEntity(entity);
    int statusCode = httpClient.executeMethod(post);