我使用嵌套字段
在2个索引中运行多索引搜索(elasticsearch 6.1.1)" UNIQUEID"是一个仅存在于person索引中的嵌套字段。
" POBOX"是一个仅存在于地址索引
中的嵌套字段我收到错误:
" index":"地址"," [嵌套]无法在路径[uniqueID]"
下找到嵌套对象" index":" person"," [嵌套]路径[pobox]下的嵌套对象不是嵌套类型"
在我的查询中,我搜索字段uniqueID的人员索引,为什么我收到仅存在于地址索引中的pobox字段的错误。对于在地址索引中搜索,它会查找仅存在于人员索引
中的uniqueId字段POST http://locahost:9200/person,adress/_search
{
"query": {
"bool": {
"should": [
{
"bool": {
"must": [
{
"terms": {
"_index": [
"person"
]
}
},
{
"nested": {
"path": "uniqueID",
"query": {
"span_near": {
"clauses": [
{
"span_term": {
"uniqueID.uniqueID.auto": "1"
}
}
],
"slop": 3,
"in_order": true
}
}
}
}
]
}
},
{
"bool": {
"must": [
{
"terms": {
"_index": [
"adress"
]
}
},
{
"nested": {
"path": "pobox",
"query": {
"span_near": {
"clauses": [
{
"span_term": {
"pobox.pobox.auto": "1"
}
}
],
"slop": 3,
"in_order": true
}
}
}
}
]
}
}
]
}
}
}

错误
{
"error": {
"root_cause": [
{
"type": "query_shard_exception",
"reason": "failed to create query: { my_query }",
"index_uuid": "9Z0W-P9ZS02kJ7WmOKHPVQ",
"index": "adress"
},
{
"type": "query_shard_exception",
"reason": "failed to create query: { my_query }",
"index_uuid": "EHoxKGhdSmKoYdNgsylotw",
"index": "person"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "adress",
"node": "AEhiq0wvQTGh468sSmDN5g",
"reason": {
"type": "query_shard_exception",
"reason": "failed to create query: { my_query }",
"index_uuid": "9Z0W-P9ZS02kJ7WmOKHPVQ",
"index": "adress",
"caused_by": {
"type": "illegal_state_exception",
"reason": "[nested] failed to find nested object under path [uniqueID]"
}
}
},
{
"shard": 0,
"index": "person",
"node": "AEhiq0wvQTGh468sSmDN5g",
"reason": {
"type": "query_shard_exception",
"reason": "failed to create query: { my_query }",
"index_uuid": "EHoxKGhdSmKoYdNgsylotw",
"index": "person",
"caused_by": {
"type": "illegal_state_exception",
"reason": "[nested] nested object under path [pobox] is not of nested type"
}
}
}
]
},
"status": 400
}