N
N
Nastya19202022-03-04 10:34:38
Amazon Web Services
Nastya1920, 2022-03-04 10:34:38

How to get a counted list of documents by field value?

I use Amazon's OpenSearch, which I understand is ES.
The index contains documents that have a custom "type" subfield. How can I get a list of the values ​​of this field contained in the index, and the number of docks for each type?

Essence of expected response:

Type: Node - 12,
Type: Folder - 10, etc.

Index:

{ _index: res-1,
_id: 1234,
...
_source: {
resource: {
....
type: Node,
}
}
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Cheremisin, 2022-03-04
@leahch

If this is elasticsearch, then you need to look at the aggressions on nested fields. But the request type depends on the version. Start here - https://www.elastic.co/guide/en/elasticsearch/ref...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question