简体   繁体   中英

elasticsearch river plugin is not creating geo_point type while indexing

I am using elasticsearch river plugin version 1.3.0.4, which is the latest as of this post, against elasticsearch version 1.3.2. I am trying to create a mapping with a geo_point type, but I keep failing to do so... Here is my mapping:

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"
          }
        }
      }
    }
  }
}

But when I run the _mapping command, it shows as:

{
  "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"
          }
        }
      }
    }
  }
}

Notice that the "location" is NOT of type geo_point, but list of properties. As suspected, when I issue a query to search for location, I got the error:

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

result:

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

Does someone know how to fix the issue? I seem to have followed the documentation exactly...

It is related to the version of elasticsearch. The jdbc-river plugin is still not compatible with elasticsearch 1.3.2.

在此处输入图片说明

When you upgrade your elasticsearch, you always need to make sure of the compatibility of its plugins. Some of them may not be supported.

For the jdbc-river plugin, you always have to check jprante plugin repo .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM