嵌套对象中的Elasticsearch布尔搜索

时间:2018-06-08 13:09:25

标签: elasticsearch

我有以下嵌套索引结构:

"sector_parametric": [

        {
            "sector": [
                "2"
            ],
            "experience": 1.7,
            "adv_business_sector_id": "637"
        },
        {
            "sector": [
                "1",
                "2",
                "10003"
            ],
            "experience": 2.7,
            "adv_business_sector_id": "642"
        }
]

编写以下查询很容易: Boolean filter on nested objects

但是我需要带有扇区1和2的文档,不一定是在同一个嵌套对象中。 所以我找到以下

"sector_parametric": [

        {
            "sector": [
                "2"
            ],
            "experience": 1.7,
            "adv_business_sector_id": "637"
        },
        {
            "sector": [
                "1",
                "10003"
            ],
            "experience": 2.7,
            "adv_business_sector_id": "642"
        }
]

这个文件也是

"sector_parametric": [

        {
            "sector": [
                "2"
            ],
            "experience": 1.7,
            "adv_business_sector_id": "637"
        },
        {
            "sector": [
                "1",
                 "2"
                "10003"
            ],
            "experience": 2.7,
            "adv_business_sector_id": "642"
        }
]

0 个答案:

没有答案