美文网首页
elasticsearch 嵌套结构(netsted)

elasticsearch 嵌套结构(netsted)

作者: Jlan | 来源:发表于2018-09-30 09:49 被阅读11次

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}
                    }
                }
            }
        }

相关文章

网友评论

      本文标题:elasticsearch 嵌套结构(netsted)

      本文链接:https://www.haomeiwen.com/subject/pgwioftx.html