In 7.10, new users, experienced users, and geospatial analysts can rejoice! It enhances the file ingestion process to automatically map longitude/latitude fields in files for you and assign the correct data types. What does that mean? Using the file upload interface for CSV data in machine learning applications, when the dataset contains fields named Latitude and longitude, the extraction process automatically merges these fields into geo_point position fields. If your fields have unrecognized names, don’t worry – you can add new fields yourself using a simple interface. You do not need to manually enter JSON.

Below, I’ll show you a very simple example. I’ll use Elastic Stack 7.10 to demonstrate this.

First, let’s download the ZIPcode CSV file with reference to our previous article “Logstash: Importing zipCode CSV Files and the Geo Search Experience” :

git clone https://github.com/liu-xiao-guo/elasticzipcodes
Copy the code

The format of the CSV file is as follows:

From the table above, we can see that there are two fields: the Longtitude and Latitude fields. We can use the following functions to import data:

What you can see clearly above is that Latitude and Logitude are automatically combined into a new geo_point data type. This feature was not available in previous versions. Let’s go to Advanced:

In some cases, your field name may not be the standard Logititude or Latitude. You may be Lat and Lon, and machine learning may not recognize your fields. In this case, we can click Add Combined Field to create a field:

As shown above, we can select the fields we want, such as Lat and Log. Of course, in our case, we’ll do the choices shown above, because these are the only options available. Click the Add button:

As shown in the figure above, we can see that there are two location information fields already my_location. Of course, this is to illustrate the problem, in practical use, we only need a location information field. We click the Import button. This completes the data import.

We can view zipCodes mapping in the Kibana Console as follows:

GET zipcodes/_mapping
Copy the code

The command above shows:

{
  "zipcodes" : {
    "mappings" : {
      "_meta" : {
        "created_by" : "ml-file-data-visualizer"
      },
      "properties" : {
        "AreaCode" : {
          "type" : "long"
        },
        "Code" : {
          "type" : "long"
        },
        "Disabled" : {
          "type" : "boolean"
        },
        "Id" : {
          "type" : "long"
        },
        "Latitude" : {
          "type" : "double"
        },
        "Longitude" : {
          "type" : "double"
        },
        "Name" : {
          "type" : "keyword"
        },
        "ShortName" : {
          "type" : "keyword"
        },
        "Sort" : {
          "type" : "long"
        },
        "location" : {
          "type" : "geo_point"
        },
        "my_location" : {
          "type" : "geo_point"
        }
      }
    }
  }
}
Copy the code

You can see the two location information fields defined earlier: location and my_location. These are data types for geo_point.