elasticsearch 嵌套结构(netsted)
2018-09-30 本文已影响11人
Jlan
map结构
"ES_data":{
"ES_index_name": "index",
"ES_doc_name": "doc",
"ES_doc_type": {
"properties": {
"id": {
"type": "integer"
},
"title": {
"type": "text"
},
"insert_time": {
"type": "date"
}
"ref_example": {
"type": "nested",
"properties": {
"example_title": {"type": "text"},
"example_content": {"type": "text"},
"example_start_time": {"type": "date"},
"example_end_time": {"type": "date"},
}
}
}
}
},
查询netsted数据
_query = \
{
"_source": "ref_example.example_content",
"query": {
"nested": {
"path": "ref_example",
"query": {
"match_phrase": {"ref_example.example_title": example_title}
}
}
}
}