Не удалось создать поле geo_point с типом данных geo_point Logstash

Я пытаюсь загрузить данные из индекса ES таблицы mysql, используя logstash. Я могу загрузить данные в ES, но отображение поля местоположения не соответствует типу geo_point. Отображается как тип ключевого слова. Так что я не могу запросить поле geo_point.

Любая помощь, в чем проблема? ЕС-версия: 6.7.0

Это мой template.json файл:

{
    "settings" :
    {
        "number_of_shards" : 1,
        "codec": "best_compression",
        "number_of_replicas" : 0,
        "index.translog.flush_threshold_size": "2g",
        "bootstrap.mlockall": true,
        "indices.fielddata.cache.size": 25%
    },
    "mappings":
    {
            "_doc" :
            '|            "dynamic_templates":
              [
                  {
                      "message_field": {
                        "path_match": "message",
                        "match_mapping_type": "string",
                        "mapping": {
                          "type": "text",
                          "norms": false
                        }
                      }
                    },
                    {
                      "string_fields": {
                        "match": "*",
                        "match_mapping_type": "string",
                        "mapping": {
                          "type": "text",
                          "norms": false,
                          "fields": {
                            "keyword": {
                              "type": "keyword",
                              "ignore_above": 256
                            }
                          }
                        }
                      }
                    }
              ],
"properties" : {
                "@timestamp": {
                     "type": "date"
                },
                "@version": {
                     "type": "keyword"
                },
                "location": {
                     "type": "geo_point"
                },
                "lat" : { "type" : "keyword", "index" : "not_analyzed","index_options" : "docs" },
                "lon" : { "type" : "keyword", "index" : "not_analyzed","index_options" : "docs" }
              }
            }
    }
}

ввод файла logstash.conf

{
        jdbc {
                ..........
    }
}
filter
{
    mutate {
        convert => { "lon" => "float" }
        convert => { "lat" => "float" }
        rename => {
            "lon" => "[location][lon]"
            "lat" => "[location][lat]"
        }
    }
}
output {
  elasticsearch {
        hosts => "host:80"
        index => "my_index"
        manage_template => "false"
        document_type => "_doc"
        template_name=>"template.json"
        document_id => "%{id}"
  }
}

person Juhan    schedule 30.07.2020    source источник
comment
Можете ли вы показать, что вы получаете при запуске GET my_index?   -  person Val    schedule 30.07.2020
comment
Также установите manage_template => "true" иначе шаблон не будет загружен   -  person Val    schedule 30.07.2020
comment
GET my_index-> ​​Дает местоположение: {свойства: {широта: {тип: float}, lon: {тип: float}}}}   -  person Juhan    schedule 30.07.2020
comment
Да, смотрите мой ответ ниже, ваш шаблон не применяется   -  person Val    schedule 30.07.2020


Ответы (1)


Я думаю, что вам просто не хватает manage_template => true, и вы также можете добавить template_overwrite => true, чтобы убедиться, что шаблон переопределен:

  elasticsearch {
        hosts => "host:80"
        index => "my_index"
        manage_template => "true"             <---- change this
        template_overwrite => true            <---- also add this
        document_type => "_doc"
        template_name=>"template.json"
        document_id => "%{id}"
  }
person Val    schedule 30.07.2020