Hi All.
I need your help, I just started working with Elasticsearch.
I have an Index with the following mapping:
{
  "mapping": {
    "_doc": {
      "properties": {
        "pending_tasks": {
          "type": "integer"
        },
        "type": {
          "type": "keyword"
        },
        "updated_at": {
          "type": "date"
        }
      }
    }
  }
}
'pending_tasks' is number of tasks wait in the queue.
'type' represent the queue type. let say it can be one of ['A', 'B', C'].
'updated_at' represent the date/time this document created.
So to my question:
I first split all documents to buckets (based on date histogram).
Now I want  to maintain in each bucket only the last document per type (['A', 'B', C']), and ignore the rest of the documents in each bucket.
How can I do this???
Now to be more specific:
I want to create a chart in Kibana based on TSVB tool, that show the pending tasks over time for each of the types ['A', 'B', C'].
The data for the number of pending task per type, for each bucket is store in the latest documents in each bucket.
Please help.
Thanks
Saar