2013-08-31 93 views
-1

我運行下面的查詢:Elasticsearch刪除查詢按日期

q='{ 
    "filtered" : { 
     "query" : { 
      "match_all" : {} 
     }, 
     "filter": { 
      "and": [ 
       { 
        "range": { 
         "creation_time": { 
         "from": "2012-08-30", 
            "to": "2012-08-31", 

           "include_lower": true, 
           "include_upper": true 
         } 
        } 
       }, 
      ] 
     } 
    } 
}' 

我的域名是一個EC2服務器

curl -XDELETE "http://#{mydomain}:9200/monitoring/mention_reports/_query?q=#{q}" 

當我打這個查詢它給了我

curl:(3)[globbing]在pos中不支持的嵌套大括號118

請幫我謝謝

回答

1

如果你想給exec命令行curl,應該看起來像:

q='YOUR_QUERY_CODE_GOES_HERE' 
curl -v -H "Content-type: application/json" -H "Accept: application/json" \ 
    -XDELETE -d $q http://localhost:9200/monitoring/mention_reports/_query 

在裏面,紅寶石執行的情況下,你應該格式化請求像你這樣做,但銀子彈仍然在標題:

-H "Content-type: application/json" -H "Accept: application/json" 
+0

感謝它的作品就像一個魅力! –