Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json 嵌套滤波器数值范围_Json_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Lucene - Fatal编程技术网 elasticsearch,lucene,Json,elasticsearch,Lucene" /> elasticsearch,lucene,Json,elasticsearch,Lucene" />

Json 嵌套滤波器数值范围

Json 嵌套滤波器数值范围,json,elasticsearch,lucene,Json,elasticsearch,Lucene,我有以下json对象: { "Title": "Terminator, "Purchases": [ {"Country": "US", "Site": "iTunes", "Price": 4.99}, {"Country": "FR", "Site": "Google", "Price": 5.99} ] } 我希望能够找到指定国家/地区+站点+价格范围的对象。例如,只要在Bool查询逻辑树中添加一个范围查询,上述内容在Country=US&Price上就会

我有以下json对象:

{
  "Title": "Terminator,
  "Purchases": [
     {"Country": "US", "Site": "iTunes", "Price": 4.99},
     {"Country": "FR", "Site": "Google", "Price": 5.99}
  ]
}

我希望能够找到指定国家/地区+站点+价格范围的对象。例如,只要在Bool查询逻辑树中添加一个范围查询,上述内容在
Country=US&Price上就会返回True。这将返回与我们匹配的国家/地区的文档,并且其价格字段的数值小于5

{ "query": 
    { "nested" : {
            "path" : "Purchases",
            "score_mode" : "avg",
            "query" : {
                "bool" : {
                    "must" : [
                        {
                            "match" : {"Purchases.Country" : "US"}
                        },
                        {
                            "range" :  "Purchases.Price":
                            {
                                "lte": 5
                            }
                        }
                    ]
                }
            }
        }
    }
}