How to get document ids alongs with aggregation result

I perfom term aggregation on elasticsearch documents that gives me the keyword and its doc count, but i also want all the id of those document that keyword belongs to. How to get that. For example

  Key: "ice cream",
  doc_count: 3

But what i want this

  Key: "ice cream",
  doc_count: 3,
  doc_ids: [ 1, 2, 3]

I think you are looking for: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-top-hits-aggregation.html

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