Data sent with curl into elastisearch are invisible in Kibana

Hello there,
I'm putting data using a simple curl command (JSON format) then I get this successful message :
{"_index":"home","_type":"doc","_id":"ox61NmABZ5bRYuBijg0_","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":18651,"_primary_term":1}

But I can't found my data on the discover tab of Kibana. My index shows my fields correctly but no lines appear...

This is how I configured my index :

    PUT home
    {
      "mappings": {
        "doc": {
          "properties": {
            "date": {
              "type": "date" 
            }
          }
        }
      }
    }

And this is my test curl command :
curl -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d "{\"message\" : \"Mesures\", \"temperature\" : 24.8, \"humidity\" : 20.2}" "http://localhost:9200/home/doc/"

Any idea on where i made a mistake ?

Thanks !

Hi there,

You need to add a date field to the document you're indexing, e.g.:

curl -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d "{\"date\": \"2017-12-08\",\"message\" : \"Mesures\", \"temperature\" : 24.8, \"humidity\" : 20.2}" "http://localhost:9200/home/doc/"

Then you need to create an index pattern under Management > Index patterns. You can name the pattern something like "home*" (the * is a wildcard so it can match multiple indices which begin with "home" though you only have one in this example) and then choose "date" for the Time Filter field name. Then you'll be able to go to Discover, select this index pattern, and when you set the time range in the top right corner so that it encompasses this document's date, you'll see it show up in the table.

See https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html for more information on the date format in Elasticsearch.

Does this help?

Thanks,
CJ

Hi Cjcenizal !
Ok, I guessed that the date was applied automatically!

I had many problems to find the correct format, at the end I used the epoch time-based.... it's working now!

Thanks you very much!

I'm glad you got it working! You're very welcome.

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