Elasticsearch configuration

Before we continue, we need to configure Elasticsearch to create a mapping. The timestamp that we generate in AWS IoT is of the type long. So, we are going to create a mapping field named datetime with the type date.

From a command line with cURL (https://curl.haxx.se/) present, execute the following command:

    curl -XPUT 'https://search-pi3-dht11-dashboard-tcvfd4kqznae3or3urx52734wi.us-east-1.es.amazonaws.com/sensor-data?pretty' -H 'Content-Type: application/json' -d'
    {
      "mappings" : {
        "dht11" : {
          "properties" : {
            "timestamp" : { "type" : "long", "copy_to": "datetime" },
            "datetime" : {"type": "date", "store": true }
          }
        }
      }
    }
    '

Replace the URL of Elasticsearch in the previous command as applicable. This will ...

Get Enterprise Internet of Things Handbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.