弹性搜索中的嵌套映射

时间:2021-06-12 14:29:16

标签: elasticsearch nested mapping

我在弹性搜索中尝试了嵌套映射,但它仍然存储为扁平对象。下面是代码。

Mapping
{ "mappings": { 
    "properties": { 
      "Name" : { "type" : "text" }, 
     "Info": { 
     "type": "nested", 
     "properties": 
          { 
             "AccountId" : { "type" : "keyword" },    
             "Address" : { "type" : "keyword" }
 } } } } }

Data
{ "Name" : "xyz", 
"Info" : [ 
           { "AccountId" : "1234", 
             "Address" : "Sm123" 
           },
          { "AccountId " : "5678", 
            "Address" : "Wh235" } ] }


POST http://localhost:9200/myindex/_search

 { "fields": ["*"]}
Output:
Instead of nested output getting single array

" fields":{"Info.AccountId":["1234","5678"]
"Info.Address":["Sm123","Wh235"]
} 

映射文件有什么问题?

0 个答案:

没有答案
相关问题