Records created by elasticsearch api can not show up in Kibana

step1: use API to create the record:
POST http://localhost:9200/twitter/tweet/34/_update

{
    "scripted_upsert":true,
    "script" : {
        "source": "ctx._source.name = params.name;",
        "lang": "painless",
        "params" : {
        	"name": "John"
        }
    }	,
    "upsert" : {
    
    }
}

and get the response as below:

{
    "_index": "twitter",
    "_type": "tweet",
    "_id": "34",
    "_version": 1,
    "result": "created",
    "_shards": {
        "total": 2,
        "successful": 1,
        "failed": 0
    }
}

step2:use get api can get this record(GET http://localhost:9200/twitter/tweet/34):

{
    "_index": "twitter",
    "_type": "tweet",
    "_id": "34",
    "_version": 1,
    "found": true,
    "_source": {
        "name": "John"
    }
}

step3: go to kibana dashboard to create the index pattern:"twitter" in "Management" tab,

step4: go to "Discover" tab and select the index "twitter" created in step3, but I can not see this record under the index:"twitter".

Elasticsearch/kibana version:5.6.3

Question moved to #kibana

Just a comment. You don’t need to use a painless script like you did just to create a document.

Step3: May be share some screenshots about what does the index look like?
Same for Step4.

step3 & step4 's screenshots as below 2 pictures:

There is no '@timestamp' in this record under this index,is that the problem?
I have tried to add '@timestamp' field for the index using:'PUT http://localhost:9200/twitter/'

          {
    "settings": {
        "number_of_shards": 1
    },
    "mappings": {
        "tweet": {
            "properties": {
                "@timestamp": {
                    "format": "strict_date_optional_time||epoch_millis",
                    "type": "date"
                }
            }
        }
    }
}

but the '@timestamp' not created after the document generated.

I add the '@timestamp' field then the record shows up in kibana.

{
    "scripted_upsert":true,
    "script" : {
        "source": "ctx._source.name = params.name;ctx._source['@timestamp']=params.timestamp",
        "lang": "painless",
        "params" : {
        	"name": "John",
        	"timestamp":"2017-11-20T13:05:23.160Z"
        }
    }	,
    "upsert" : {
    
    }
}
1 Like

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