引起:org.elasticsearch.common.ParsingException:[bool]格式错误 查询,预期[END_OBJECT]但找到[FIELD_NAME]
这是我的请求方式:
$scope.questions = [
{
"_id": "59df6c37b6748bc809050699",
"user": {
"_id": "59df6a76b6748bc809050697",
"profileImageURL": "modules/users/client/img/profile/default.png"
},
"__v": 1,
"openeyers": [],
"openeyes": 0,
"upvoters": [],
"upvotes": 0,
"isLiked": false,
"users": [],
"comments": [
{
"created": 1507897712831,
"email": "ms@e21designs.com",
"name": "Maniselvam selvam",
"link": "https://drive.google.com/drive/u/0/folders/0B5c-p1bvkfS9REJHMGhMY1BTV1k",
"commentText": "7A"
}
],
"questionid": "",
"title": "Silver jublie",
"created": "2017-10-12T13:20:55.383Z"
},
{
"_id": "59df6c37b6748bc809050699",
"user": {
"_id": "59df6a76b6748bc809050697",
"displayName": "Maniselvam selvam",
"dob": "1991-05-10T07:00:00.000Z",
"profileImageURL": "modules/users/client/img/profile/default.png"
},
"__v": 1,
"openeyers": [],
"users": [],
"comments": [
{
"created": 1507897712831,
"email": "ms@e21designs.com",
"name": "Maniselvam selvam",
"link": "https://drive.google.com/drive/u/0/folders/0B5c-p1bvkfS9REJHMGhMY1BTV1k",
"commentText": "8A"
}
],
"questionid": "",
"title": "Public School",
"created": "2017-10-12T13:20:55.383Z"
}
]
答案 0 :(得分:0)
您的查询有几个问题,当您查看一些ES查询示例时,它们很快就会被发现。
query
aggs
密钥应该在query
之后,而不是在bool
${timestamp_from}
和${timestamp_to}
是什么所以正确的查询可能是
{
"query": {
"bool": {
"must": [
{
"range": {
"timestamp": {
"gt": 1409795880274,
"lt": 1509795880274,
"include_lower": true,
"include_upper": false
}
}
}
]
}
},
"aggs": {
"max_timestamp": {
"max": {
"field": "timestamp"
}
}
}
}