in golang how to use user generated id and increment it for every new entry? I tried
Index(KpiIndex). Type(KpiDocType). Id(ids). => Id will take only stings. BodyJson(kpis). Do(elasticSearchContext)
And when data is getting stored in ES, it is getting stored in randomly say
{ "took" : 5, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 4, "max_score" : 1.0, "hits" : [ { "_index" : "kpi", "_type" : "kpi", "_id" : "AWIexPLwnbh5r7Xr9nsL", "_score" : 1.0, "_source" : { "date" : "2018-03-13 15:20:45", "kpi" : [ {
"Static_limit" : 0 }, { "CpuAverageLoad" : 0, ..., "NodeType" : "kkk", "State" : "online" } ] } }, { "_index" : "kpi", "_type" : "kpi", "_id" : "AWIexYy1_xnN0Y7Qo1HE", "_score" : 1.0, "_source" : { "date" : "2018-03-13 15:21:25", "kpi" : [ { "CpuAverageLoad" : 0, }, { "CpuAverageLoad" : 0, ..., "NodeType" : "kkk", "State" : "online" } ] } }, { "_index" : "kpi", "_type" : "kpi", "_id" : "AWIexdrLnbh5r7Xr9nsM", "_score" : 1.0, "_source" : { "date" : "2018-03-13 15:21:45", "kpi" : [ { "Static_limit" : 0 }, { "CpuAverageLoad" : 0, ..., "NodeType" : "kkk", "State" : "online" } ] } }, { "_index" : "kpi", "_type" : "kpi", "_id" : "AWIexT52BjtG8JuPSysx", "_score" : 1.0, "_source" : { "date" : "2018-03-13 15:21:05", "kpi" : [ { "Static_limit" : 0 }, { "CpuAverageLoad" : 0, ..., "NodeType" : "kkk", "State" : "online" } ] } } ]
} }
When we observe the 'data' field, the order is
"date" : "2018-03-13 15:20:45",
"date" : "2018-03-13 15:21:25",
"date" : "2018-03-13 15:21:45",
"date" : "2018-03-13 15:21:05",
where as the correct order should be
"date" : "2018-03-13 15:20:45",
"date" : "2018-03-13 15:21:05",
"date" : "2018-03-13 15:21:25",
"date" : "2018-03-13 15:21:45"