mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-06 13:08:29 +00:00
c595322d90
The change adds a new option to the geo_* queries: ignore_unmapped. If this option is set to false, the toQuery method on the QueryBuilder will throw an exception if the field specified in the query is unmapped. If the option is set to true, the toQuery method on the QueryBuilder will return a MatchNoDocsQuery. The default value is false so the queries work how they do today (throwing an exception on unmapped field)
40 lines
1.2 KiB
Plaintext
40 lines
1.2 KiB
Plaintext
[[query-dsl-geo-distance-range-query]]
|
|
=== Geo Distance Range Query
|
|
|
|
Filters documents that exists within a range from a specific point:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
{
|
|
"bool" : {
|
|
"must" : {
|
|
"match_all" : {}
|
|
},
|
|
"filter" : {
|
|
"geo_distance_range" : {
|
|
"from" : "200km",
|
|
"to" : "400km",
|
|
"pin.location" : {
|
|
"lat" : 40,
|
|
"lon" : -70
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
|
|
Supports the same point location parameter and query options as the
|
|
<<query-dsl-geo-distance-query,geo_distance>>
|
|
filter. And also support the common parameters for range (lt, lte, gt,
|
|
gte, from, to, include_upper and include_lower).
|
|
|
|
[float]
|
|
==== Ignore Unmapped
|
|
|
|
When set to `true` the `ignore_unmapped` option will ignore an unmapped field
|
|
and will not match any documents for this query. This can be useful when
|
|
querying multiple indexes which might have different mappings. When set to
|
|
`false` (the default value) the query will throw an exception if the field
|
|
is not mapped.
|