小编典典

如何在Elasticsearch中将CURL转换为URI

elasticsearch

我有一个curl命令,用于elasticsearch聚合,如下所示。

curl -XGET "http://localhost:9200/employee/_search?search_type=count&pretty" -d '{
  "aggregations": {
    "profile": {
      "terms": {
        "field": "_type"
      },
      "aggs": {
        "hits": {
          "top_hits": {
            "size": 1
          }
        }
      }
    }
  }
}'

我想在浏览器中将以上这些卷曲搜索到我的htmlpage中,如何将其转换为类似Elasticsearch中URI搜索的普通url?

请帮助我将上面的内容转换为url吗?


阅读 404

收藏
2020-06-22

共1个答案

小编典典

您可以使用source查询字符串参数,以便直接在URL中传递正文

curl -XGET 'http://localhost:9200/employee/_search?search_type=count&pretty&source={"aggregations":{"profile":{"terms":{"field":"_type"},"aggs":{"hits":{"top_hits":{"size":1}}}}}}'
                                                                              ^
                                                                              |
                                                           use the source parameter
2020-06-22