将CURL请求转换为RestClient请求

时间:2015-02-13 03:46:01

标签: ruby-on-rails elasticsearch rest-client

我有一个curl请求从elasticsearch

获取数据
curl -XGET "http://localhost:9200/_all/_search?search_type=count&q=_type:invoice" -d '
    {
    "aggs" :
        {
            "by_index" :
                {"terms" : {"field" : "_index"}},
            "aggs" :
                {"by_state" : {"terms" : {"field" : "state"}}}
        }
}'

我在终端上工作正常,现在在应用程序中我正在使用此请求。

我正在使用RestClient发送GET请求:

RestClient.get curl -XGET "http://localhost:9200/_all/_search?search_type=count&q=_type:invoice"

我如何像在curl请求中那样将过滤器传递给它?

0 个答案:

没有答案