[source, ruby]
----
response = client.search(
  body: {
    aggregations: {
      genres: {
        rare_terms: {
          field: 'genre',
          max_doc_count: 2
        }
      }
    }
  }
)
puts response
----
