Query help: get distinct Search base on created_at

hi
first, I have apologized for my weak English, I store data in the elastic search like this

{
      "_index": "my_index",
      "_type": "doc",
      "_id": "6lDquGEBFRQVe0x93eHk",
      "_version": 1,
      "_score": 1,
      "_source": {
        "Barcode": "6947503728601",
        "category":"pen", 
        "name": "panter",
         "price":"4$",
        "created_at": "1519225855"
      }
      }

Each data set has a barcode. For example, all panter pen have "6947503728601" as a barcode but they have different created_at values.

I want to search for a barcode and get the last one of them based on the created_at value (I want to get one)

How can I implement the search?

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