I have created an index and I would like to get the latest value available in the index
e.g.:
{
"_index": "tester",
"_type": "_doc",
"_id": "Qujl-nMBaIdydddddd",
"_version": 1,
"_score": 0,
"_source": {
"brd_part_no": "55-a54tt-08",
"brd_rev": "B",
"operator_id": "0230057",
"serial_no": "sdeiek649",
"test_status": "06",
"start_time": "200303224308",
"test_time": "000079",
"end_time": "200303224427",
"sent_time": "2020-08-17T13:30:08.670463"
},
"fields": {
"end_time": [
"2020-03-03T22:44:27.000Z"
],
"sent_time": [
"2020-08-17T13:30:08.670Z"
],
"start_time": [
"2020-03-03T22:43:08.000Z"
]
}
}
I would like to get the latest serial no available and visualize it:
Current Serial Number: < Latest Serial Number >
Is there a way to retrieve the latest-record serial number
thank you
matw
(Matthias Wilhelm)
September 17, 2020, 8:16am
2
Hi
Would something like this work? It's the metric visualization of Kibana, you would just need to switch the field to serial_no
, and sort by sent_time
(I think that's the date when it was sent to Elasticsearch)?
Best,
Matthias
thank you Matthias for the swift reply
I have tried this earlier, but didn't help as I didn't see serial_no field in the list of fields.
Is there something wrong in the mapping
even manully writing the field name indicates there is no field match
{
"mapping": {
"properties": {
"brd_part_no": {
"type": "text"
},
"brd_rev": {
"type": "text"
},
"end_time": {
"type": "date",
"format": "yyMMddHHmmss"
},
"operator_id": {
"type": "text"
},
"sent_time": {
"type": "date"
},
"serial_no": {
"type": "text",
"fielddata": true
},
"start_time": {
"type": "date",
"format": "yyMMddHHmmss"
},
"test_status": {
"type": "text"
},
"test_time": {
"type": "integer"
},
"tester_host": {
"type": "text"
}
}
}
}
yes I think sent_time is the time when the record was sent to ES
Thank you
matw
(Matthias Wilhelm)
September 17, 2020, 8:41am
4
You should switch the type of serial_no to "keyword" ... here's why:
Best,
Matthias
thank you Matthias,
after changing the field type to keyword, it worked.
Thanks!
1 Like
system
(system)
Closed
October 15, 2020, 8:56am
6
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.