我的弹性查询出错 - 范围 returns 错误请求

Error in my elasticquery - Range returns bad request

我有以下功能可以进行弹性搜索:

$scope.getLocationHistory = function(device, lastTime){

    console.log("Device location searching");

    query = {
        "query": {
            "bool": {          
                "must": [
                    { "term": {"deviceId":device} },
                    { "match": {"eventType":"Connected"} } 
                ],
                "must_not":[
                    {"query_string": {
                            "query": "Pong",
                            "fields": ["data.message"]
                        }
                    },
                ] 
            }                  
        },
        "range" : {
            "timestamp" : {
                "gt" : "now-1h"
            }
        },
        "filter" : {
            "exists" : { "field" : "data.location" }
        },
        "sort": [{ "timestamp": { "order": "desc" }}]
    }

    $http.post(databaseLocation+"/canary/_search", query).success(function(data, status, headers, config){
        $scope.getMapHistory(data.hits.hits); //Auxiliary function
    }).error(function(data, status, headers, config){
        console.log(data);
    }); 

}

我是弹性查询的新手,我在范围字段中遇到此错误:

POST http://... 400 (Bad Request) Object {error: "SearchPhaseExecutionException[Failed to execute ph…arse Failure [No parser for element [range]]]; }]", status: 400}error: "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed;....

可能我写错了范围字段,但我在这个文档上找到了如何使用它:www.elasticsearch.org/...

我想知道我在查询中做错了什么。

已编辑 我只需要向范围添加另一个过滤器并且它可以工作,但是如果将范围作为必须参数

则性能会更好
    query = {
        "query": {
            "bool": {          
                "must": [
                    { "range" : { "timestamp" : { "gt" : timeRange }}},
                    { "term": {"deviceId":device} },
                    { "match": {"eventType":"Connected"} } 
                ],
                "must_not":[{
                        "query_string": {
                            "query": "Pong",
                            "fields": ["data.message"]
                        }
                    },
                ] 
            },

        },
        "filter": { 
            "exists" : { "field":"data.location" }
        },
        "sort": [{ "timestamp": { "order": "desc" }}]
    }