Вам нужно удалить пустую строку под URL-адресом
GET _search
<--- remove this line
{
"query": {
Как это:
GET _search
{
"query": {
Я хочу получить диапазон дат с определенным идентификатором, но мой результат включает в себя другие идентификаторы. Мне нужна помощь в проверке запроса.
Это то, что я пытаюсь сделать
Fectch все документы, где uniqueid == 1 и начало диапазона от 2016-10-11T12: 00: 30.000Z до "2016-10-12T12: 00: 30.000Z"
Мой запрос и результаты показаны ниже.
запрос
GET _search
{
"query": {
"constant_score": {
"filter": {
"bool": {
"must": [
{
"term": {
"uniqueid": 1
}
}
],
"should": [
{
"range": {
"start": {
"from": "2016-10-11T12:00:30.000Z",
"to": "2016-10-12T12:00:30.000Z"
}
}
}
]
}
}
}
}
}
результат
{
"took": 15,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 6,
"max_score": 1,
"hits": [
{
"_index": "cdr",
"_type": "face",
"_id": "AVfDCsC-vh94Tg1hrkix",
"_score": 1,
"_source": {
"start": "2016-10-12T12:00:30.000Z",
"answer": "2016-10-12T12:00:25.000Z",
"end": "2016-10-12T12:00:35.000Z",
"duration": 50,
"billsec": 55,
"uniqueid": 1,
"is_successful": true,
"is_clicked": true
}
},
{
"_index": "cdr",
"_type": "face",
"_id": "AVfDCucPvh94Tg1hrkiy",
"_score": 1,
"_source": {
"start": "2016-10-12T12:00:30.000Z",
"answer": "2016-10-12T12:00:25.000Z",
"end": "2016-10-12T12:00:35.000Z",
"duration": 50,
"billsec": 55,
"uniqueid": 2,
"is_successful": true,
"is_clicked": true
}
},
{
"_index": "cdr",
"_type": "face",
"_id": "AVfDC1G2vh94Tg1hrkiz",
"_score": 1,
"_source": {
"start": "2016-10-13T12:00:30.000Z",
"answer": "2016-10-13T12:00:25.000Z",
"end": "2016-10-13T12:00:35.000Z",
"duration": 50,
"billsec": 55,
"uniqueid": 2,
"is_successful": true,
"is_clicked": true
}
},
{
"_index": "cdr",
"_type": "face",
"_id": "AVfDC2IGvh94Tg1hrki0",
"_score": 1,
"_source": {
"start": "2016-10-13T12:00:30.000Z",
"answer": "2016-10-13T12:00:25.000Z",
"end": "2016-10-13T12:00:35.000Z",
"duration": 50,
"billsec": 55,
"uniqueid": 1,
"is_successful": true,
"is_clicked": true
}
},
{
"_index": "cdr",
"_type": "face",
"_id": "AVfDCCOOvh94Tg1hrkiv",
"_score": 1,
"_source": {
"start": "2016-10-10T12:00:15.000Z",
"answer": "2016-10-10T12:00:25.000Z",
"end": "2016-10-10T12:00:35.000Z",
"duration": 25,
"billsec": 25,
"uniqueid": 1,
"is_successful": true,
"is_clicked": true
}
},
{
"_index": "cdr",
"_type": "face",
"_id": "AVfDCR2Uvh94Tg1hrkiw",
"_score": 1,
"_source": {
"start": "2016-10-11T12:00:15.000Z",
"answer": "2016-10-11T12:00:25.000Z",
"end": "2016-10-11T12:00:35.000Z",
"duration": 25,
"billsec": 25,
"uniqueid": 1,
"is_successful": true,
"is_clicked": true
}
}
]
}
}