带范围过滤器的 Elasticsearch 地理多边形查询
Elasticsearch Geo Polygon query with range filter
我正在尝试使用地理多边形点从 Elasticsearch 检索一些图像字段。但是我也想使用日期字段过滤掉图像。以下两个查询有效。是否可以将它们合二为一?我非常感谢任何帮助。
**Query 1**
GET /manyimages_*/_search/
{
"query": {
"bool" : {
"filter" : {
"range": {"c_datetime": {"gte" : "2020-07-30T09:03:17.000"}}
}
}
}
}
**Query 2**
GET /manyimages_*/_search/
{
"size":10000,
"query":
{
"geo_polygon":
{"location":
{"points": [[-98.59526078405563, 29.48456853315911],
[-98.59393149263758, 29.485036283823487],
[-98.58712997745901, 29.48730046713193]]}
,"validation_method":"STRICT","ignore_unmapped":false,"boost":1.0
}
}
,"_source":{"includes":["latitude","longitude","bearing_deg","c_datetime"],"excludes":["location"]
}
}
是的,您可以简单地在 bool/filter
子句中包含两个约束:
GET /manyimages_*/_search/
{
"query": {
"bool": {
"filter": [
{
"range": {
"c_datetime": {
"gte": "2020-07-30T09:03:17.000"
}
}
},
{
"geo_polygon": {
"location": {
"points": [
[
-98.59526078405563,
29.48456853315911
],
[
-98.59393149263758,
29.485036283823487
],
[
-98.58712997745901,
29.48730046713193
]
]
},
"validation_method": "STRICT",
"ignore_unmapped": false,
"boost": 1
}
}
]
}
}
}
我正在尝试使用地理多边形点从 Elasticsearch 检索一些图像字段。但是我也想使用日期字段过滤掉图像。以下两个查询有效。是否可以将它们合二为一?我非常感谢任何帮助。
**Query 1**
GET /manyimages_*/_search/
{
"query": {
"bool" : {
"filter" : {
"range": {"c_datetime": {"gte" : "2020-07-30T09:03:17.000"}}
}
}
}
}
**Query 2**
GET /manyimages_*/_search/
{
"size":10000,
"query":
{
"geo_polygon":
{"location":
{"points": [[-98.59526078405563, 29.48456853315911],
[-98.59393149263758, 29.485036283823487],
[-98.58712997745901, 29.48730046713193]]}
,"validation_method":"STRICT","ignore_unmapped":false,"boost":1.0
}
}
,"_source":{"includes":["latitude","longitude","bearing_deg","c_datetime"],"excludes":["location"]
}
}
是的,您可以简单地在 bool/filter
子句中包含两个约束:
GET /manyimages_*/_search/
{
"query": {
"bool": {
"filter": [
{
"range": {
"c_datetime": {
"gte": "2020-07-30T09:03:17.000"
}
}
},
{
"geo_polygon": {
"location": {
"points": [
[
-98.59526078405563,
29.48456853315911
],
[
-98.59393149263758,
29.485036283823487
],
[
-98.58712997745901,
29.48730046713193
]
]
},
"validation_method": "STRICT",
"ignore_unmapped": false,
"boost": 1
}
}
]
}
}
}