【发布时间】:2020-03-28 02:53:11
【问题描述】:
我有以下索引映射:
PUT testing/_mapping
{
"properties": {
"location": {
"type": "geo_shape"
}
}
}
我索引了两个文档:
PUT testing/_doc/1
{
"location": {
"type": "point",
"coordinates": [13.400544, 52.530286]
}
}
PUT testing/_doc/2
{
"location": {
"type" : "linestring",
"coordinates" : [[-77.03653, 38.897676], [-77.009051, 38.889939]]
}
}
现在我想按地理形状类型查找文档,例如只有type=point 的文档(文档 1)。在 Elasticsearch 中可以吗?我尝试了以下搜索,但它总是返回 0 个结果。
GET testing/_search
{
"query":{
"bool": {
"must": [
{
"term": {
"location.type": {
"value": "point"
}
}
}
]
}
}
}
我正在使用 Elasticsearch 7.2.1。
【问题讨论】:
标签: elasticsearch