0
我有一個彈性的搜索索引,映射如下:彈性搜索不返回匹配的數據
{
"issues": {
"mappings": {
"issues": {
"properties": {
"captured_by": {
"type": "long"
},
"captured_on": {
"type": "date",
"format": "dateOptionalTime"
},
"description": {
"type": "string"
},
"id": {
"type": "string",
"index": "not_analyzed"
},
"updated_at": {
"type": "date",
"format": "dateOptionalTime"
}
"issue_org_states": {
"type": "nested",
"properties": {
"assigned_at": {
"type": "date",
"format": "dateOptionalTime"
},
"assigned_by": {
"type": "long"
},
"updated_at": {
"type": "date",
"format": "dateOptionalTime"
},
"updated_by": {
"type": "long"
}
}
}
}
}
}
}
}
正如下面一個文檔填充:
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "issues",
"_type": "issues",
"_id": "13f3bf09-08cb-4464-b326-15872bdb0870",
"_score": 1,
"_source": {
"id": "13f3bf09-08cb-4464-b326-15872bdb0870",
"description": "Sloppy paint job",
"captured_on": "2017-10-09T09:24:01.928Z",
"captured_by": 1,
"updated_at": "2017-10-09T12:47:22.982Z",
"issue_org_states": [
{
"updated_at": "2017-10-09T12:47:22.982Z",
"updated_by": 1,
"assigned_at": "2017-10-09T12:47:22.982Z",
"assigned_by": 1879048240
}
]
}
}
]
}
}
我想在路徑「的問題做查詢。 issue_org_states「屬性assigned_at和updated_at。 查詢如下:
{
"query": {
"nested": {
"path": "issue_org_states",
"range": {
"assigned_at": {
"from": "2017-10-09T00:00:00.000Z",
"to": "2017-10-09T23:59:59.999Z",
"include_lower": true,
"include_upper": true
}
}
}
}
}
當我運行上面查詢它的返回數據。但是,如果在updated_at上運行相同的查詢而不是assigned_at,則彈性搜索返回0結果。 assigned_at和updated_at都具有相同的映射和相同的數據,直到查詢不返回任何結果。
{
"query": {
"nested": {
"path": "issue_org_states",
"range": {
"updated_at": {
"from": "2017-10-09T00:00:00.000Z",
"to": "2017-10-09T23:59:59.999Z",
"include_lower": true,
"include_upper": true
}
}
}
}
}
如果我在這裏丟失任何東西,請幫忙。
它的工作完美。謝謝你。 – anunaki