Mapping issue

Hi I am a beginner in Elasticsearch so pardon my silly questions. I am trying to feed a json file through Logstash to Elasticsearch so I can later create visualizations in Kibana. However after I create the index and set the mapping I want, when I run the logstash.conf to import the data elasticsearch creates it's own mapping. And if I set dynamic = "strict" I get an error:

"error"=>{"type"=>"strict_dynamic_mapping_exception", "reason"=>"mapping set to strict, dynamic introduction of [Europe] within [_doc] is not allowed"}

This is my mapping:

curl -XPUT 127.0.0.1:9200/weather -d '
{
"mappings": { "dynamic": "strict",
"properties": {
"Date" : {"type": "date"},
"Time" : {"type" : "integer"},
"City": { "dynamic": "strict",
"properties": {
"CityName": {"type": "text"},
"Temp": {"type": "integer"},
"Humidity": {"type": "integer"},
"WindDirection": {"type": "text"},
"WindSpeed": {"type": "integer"}
}
}
}
}
}'

And this is my data:

{
        "Europe" => {
        "DateTime" => {
            "Time" => "15",
             "Date" => "08.08.2020"
        },
               "City" => [
            [ 0] {
                "WindSpeed" => "03",
                     "CityName" => "Amsterdam",
                       "Humidity" => "33",
                 "WindDirection" => "NE",
                        "Temp" => "32"
            },
            [ 1] {
                "WindSpeed" => "06",
                     "CityName" => "Ankara",
                       "Humidity" => "18",
                 "WindDirection" => "E",
                        "Temp" => "33"
            },

Any input would be really appreciated.

What does the post you are using look like?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.