我对弹性搜索还很陌生,想在条件匹配时为特定字段的所有值编写查询,我尝试构建以下查询,基本上是从Kibana进行的,我复制了请求主体并尝试与ES节点一起运行。
curl -XGET "http://localhost:9200/test_index/_search?pretty" -H 'Content-Type: application/json' -d'
{
"version": true,
"size": 500,
"sort": [
{
"actual_start": {
"order": "desc",
"unmapped_type": "boolean"
}
}
],
"_source": {
"excludes": []
},
"aggs": {
"2": {
"date_histogram": {
"field": "actual_start",
"interval": "5m",
"time_zone": "Asia/Kolkata",
"min_doc_count": 1
}
}
},
"stored_fields": [
"*"
],
"script_fields": {},
"docvalue_fields": [
{
"field": "Updated",
"format": "date_time"
},
{
"field": "actual_end",
"format": "date_time"
},
{
"field": "actual_start",
"format": "date_time"
},
{
"field": "created_on",
"format": "date_time"
},
{
"field": "planned_start",
"format": "date_time"
}
],
"query": {
"bool": {
"must": [
{
"match_all": {}
},
{
"exists": {
"field": "Number"
}
},
{
"match_phrase": {
"change_manager_group": {
"query": "Change Managers - 2"
}
}
},
{
"range": {
"actual_start": {
"gte": 1556028682454,
"lte": 1556043082454,
"format": "epoch_millis"
}
}
}
],
"filter": [],
"should": [],
"must_not": []
}
}'
我收到以下错误,我相信这与格式化查询有关
{
"error" : {
"root_cause" : [
{
"type" : "json_e_o_f_exception",
"reason" : "Unexpected end-of-input: expected close marker for Object (start marker at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@177d880d; line: 2, column: 1])\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@177d880d; line: 85, column: 1448]"
}
],
"type" : "json_e_o_f_exception",
"reason" : "Unexpected end-of-input: expected close marker for Object (start marker at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@177d880d; line: 2, column: 1])\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@177d880d; line: 85, column: 1448]"
},
"status" : 500
}
我在这里做错了什么?