0

我正在通过 jdbc 连接从 MS sql server 2012 检索几何数据并将其推送到 elasticsearch。数据表包括:objectid & shape。在 Kibana 中,数据如下所示。

  "objectid": 8,
     "untitled": "POLYGON ((16131003.104400001 -4962095.885400001, 16131161.300499998 -4962011.5243000016, 16130990.071999997 -4961961.9569999985, 16131003.104400001 -4962095.885400001))",

这里的“形状”字段显示为“无标题”,在映射上它显示数据类型为文本,

 "untitled": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              }

我正在使用以下查询从 Kibana 查询数据,它提示我以下错误。

GET geo/_search
{
    "query": {
        "bool" : {
            "must" : {
                "match_all" : {}
            },
            "filter" : {
                "geo_polygon" : {
                    "untitled" : {
                        "points" : [
                        {"lat" : 16131003.104400001, "lon" : -4962095.885400001},
                        {"lat" : 16131161.300499998, "lon" : -4962011.5243000016},
                        {"lat" : 16130990.071999997, "lon" : -4961961.9569999985},
                        {"lat" : 16131003.104400001, "lon" : -4962095.885400001}
                        ]
                    }
                }
            }
        }
    }
}



  "error": {
    "root_cause": [
      {
        "type": "query_shard_exception",
        "reason": "field [untitled] is not a geo_point field",
        "index_uuid": "WEVvAQgASeap6n1eyOZ54g",
        "index": "geo"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "geo",
        "node": "LuX-kU91RqqzKj-0DKFN6Q",
        "reason": {
          "type": "query_shard_exception",
          "reason": "field [untitled] is not a geo_point field",
          "index_uuid": "WEVvAQgASeap6n1eyOZ54g",
          "index": "geo"
        }
      }
    ]
  },
  "status": 400
}

如果有人能帮助我解决这个问题,我将不胜感激。

附言。我对弹性搜索非常陌生,对任何愚蠢的问题感到抱歉:(

干杯

4

1 回答 1

0

您需要将字段的映射更改为untitled地理形状

然后您应该能够使用地理形状查询

于 2018-07-18T06:26:54.207 回答