term

fun term(field: String, size: Int, name: String = field): TermFacet

Finds the size most frequent values for field among all documents matching the search query.

See also

Parameters

field

Name of the document field to inspect. The field should be indexed using the text type and the keyword analyzer, otherwise multi-term values are tokenized which might cause unexpected results.

name

An arbitrary name to assign to this facet. Can be used to identify the associated TermFacetResult from the search response.