dinesh_c
(dinesh c)
October 28, 2019, 11:00am
1
By using terms aggregation I am getting terms as well as doct count but i need only terms is there a way to get only terms.
this is the default response
...
"aggregations" : {
"genres" : {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets" : [
{
"key" : "jazz",
"doc_count" : 10
},
{
"key" : "rock",
"doc_count" : 10
},
{
"key" : "electronic",
"doc_count" : 10
},
]
}
}
}
But i need
{
"aggregations": {
"genres": {
"keys": [
"jazz",
"rock",
"electronic"
]
}
}
}
spinscale
(Alexander Reelsen)
October 31, 2019, 1:11pm
2
you could use the filter_path parameter - however the numbers would still be calculated though, just omitted in the response. You can however not change the response.
dinesh_c
(dinesh c)
October 31, 2019, 4:50pm
3
I do not understand how to use filter path to get the required response. Can you please explain?
spinscale
(Alexander Reelsen)
November 4, 2019, 9:53am
4
you could filter on aggregations.genres.buckets.**.key
and see if that works to only extract the keys. You cannot modify the JSON though.
dinesh_c
(dinesh c)
November 5, 2019, 8:10am
5
Thanks for your reply, now I understand your previous comments also.Can you please tell me is there a way not to calculate the docs_count.
spinscale
(Alexander Reelsen)
November 5, 2019, 9:37am
6
The doc_count
is always calculated, unless another metric aggregation is specified.
dinesh_c
(dinesh c)
November 5, 2019, 10:21am
7
Hi @spinscale ,
thanks for your quick reply can you give an example how to pass another metric.
spinscale
(Alexander Reelsen)
November 5, 2019, 10:22am
8
dinesh_c
(dinesh c)
November 5, 2019, 10:52am
9
There is no java api for filter_path. Isn't it?
spinscale
(Alexander Reelsen)
November 6, 2019, 8:56am
10
system
(system)
Closed
December 4, 2019, 8:59am
11
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.