【问题标题】:elasticsearch river plugin is not creating geo_point type while indexingelasticsearch river 插件在索引时未创建 geo_point 类型
【发布时间】:2014-10-07 17:28:04
【问题描述】:

我正在使用 elasticsearch river 插件版本 1.3.0.4,它是本文的最新版本,与 elasticsearch 版本 1.3.2。 我正在尝试使用 geo_point 类型创建映射,但我一直没有这样做...... 这是我的映射:

PUT /_river/tehotels/_meta
{
  "type": "jdbc",
  "jdbc": {
    "driver": "com.mysql.jdbc.Driver",
    "url": "jdbc:mysql://localhost:3306/blah",
    "user": "",
    "password": "",
    "sql": "select id,hotel_id,hotel_name,hotel_url,hotel_address,overview,city_id,star_rating,latitude as \"location.lat\",longitude as \"location.lon\" from agoda_hotels",
    "strategy": "simple",
    "autocommit": true,
    "fetchsize": 10,
    "max_rows": 0,
    "max_retries": 3,
    "max_retries_wait": "30s",
    "maxbulkactions": 1000,
    "maxconcurrentbulkactions": 8,
    "index": "teindex8",
    "type": "hotels",
    "type_mapping": {
      "hotels": {
        "properties": {
          "_id": {
            "type": "long"
          },
          "hotel_id": {
            "type": "long"
          },
          "hotel_name": {
            "type": "string"
          },
          "hotel_url": {
            "type": "string",
            "index": "no"
          },
          "hotel_address": {
            "type": "string",
            "index": "no"
          },
          "overview": {
            "type": "string",
            "index": "no"
          },
          "city_id": {
            "type": "long",
            "index": "no"
          },
          "star_rating": {
            "type": "float"
          },
          "location": {
            "type": "geo_point"
          }
        }
      }
    }
  }
}

但是当我运行_mapping 命令时,它显示为:

{
  "teindex8": {
    "mappings": {
      "hotels": {
        "properties": {
          "city_id": {
            "type": "long"
          },
          "hotel_address": {
            "type": "string"
          },
          "hotel_id": {
            "type": "long"
          },
          "hotel_name": {
            "type": "string"
          },
          "hotel_url": {
            "type": "string"
          },
          "id": {
            "type": "long"
          },
          "location": {
            "properties": {
              "lat": {
                "type": "string"
              },
              "lon": {
                "type": "string"
              }
            }
          },
          "overview": {
            "type": "string"
          },
          "star_rating": {
            "type": "double"
          }
        }
      }
    }
  }
}

请注意,“位置”不是 geo_point 类型,而是属性列表。正如怀疑的那样,当我发出查询以搜索位置时,我收到了错误:

POST /teindex8/hotels/_search
{
  "query": {
    "filtered": {
      "filter": {
        "geo_distance": {
          "distance": "20 km",
          "location": "13.441111, 103.858611"
        }
      }
    }
  }
}

结果:

QueryParsingException[[teindex8] failed to find geo_point field [location]]; 

有人知道如何解决这个问题吗?我似乎完全按照文档...

【问题讨论】:

  • 这可能与 ElasticSearch 版本为 1.3.2 相关(插件版本 1.3.0.4 与 v1.3.1 相关)。您是否尝试过快速设置 1.3.1 ES 集群并测试相同的请求?
  • 回复如下。问题已解决。谢谢。

标签: elasticsearch elasticsearch-jdbc-river


【解决方案1】:

与elasticsearch的版本有关。 jdbc-river 插件仍然不兼容elasticsearch 1.3.2。

升级 elasticsearch 时,您始终需要确保其插件的兼容性。其中一些可能不受支持。

对于 jdbc-river 插件,您始终必须检查 jprante 插件repo

【讨论】:

  • 好的,我通过在运行 Jdbc 负载的 PUT 命令之前创建映射解决了这个问题。到目前为止效果很好!感谢您的回复。
  • @dickyj 如果对您有帮助,请您验证我的回答! :) 提前感谢
猜你喜欢
  • 1970-01-01
  • 2015-02-06
  • 2012-12-18
  • 1970-01-01
  • 2011-12-17
  • 2013-12-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多