Elasticsearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口。Elasticsearch是用Java语言开发的,并作为Apache许可条款下的开放源码发布,是一种流行的企业级搜索引擎。Elasticsearch用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。官方客户端在Java、.NET(C#)、PHP、Python、Apache Groovy、Ruby和许多其他语言中都是可用的。根据DB-Engines的排名显示,Elasticsearch是最受欢迎的企业搜索引擎,其次是Apache Solr,也是基于Lucene。
Elasticsearch实际上也可以看做是一个数据库,但是和传统的数据库在结构式有区别:
database(数据库) | index(索引库) |
---|---|
table(表) | type(类型) |
row(行) | document(文档) |
column(列) | field(字段) |
Elasticsearch 可以通过Rustful Api 来操作索引库
method | url地址 | 描述) |
---|---|---|
PUT | http://localhost:9200/索引名称/类型名称/文档Id | 创建文档,指定文档Id |
POST | http://localhost:9200/索引名称/类型名称 | 创建文档,随机文档Id |
POST | http://localhost:9200/索引名称/类型名称/文档Id/_update | 修改文档 |
DELETE | http://localhost:9200/索引名称/类型名称/文档Id | 删除文档 |
GET | http://localhost:9200/索引名称/类型名称/_search/文档Id | 通过文档Id查询 |
POST | http://localhost:9200/索引名称/类型名称/_search | 查询所有数据 |
ELK三件套 下载地址
windows 安装注意如果你的电脑配置不是很好,请修改 jvm.options
文件,将下面2个配置改小点
然后双击 elasticsearch.bat
输入 http://localhost:9200 验证是否成功
出现上面的图片代表windows elasticsearch
服务开启成功
IK 分词器安装
下载地址:https://github.com/medcl/elasticsearch-analysis-ik
在 elasticsearch > plugins 文件夹下 创建 ik 文件夹,将ik内容复制到新创建的ik目录即可。重启elasticsearch 服务。查看日志ik分词器插件是否被加载。
[图片上传失败...(image-b15b7b-1651740381336)]E:\学习笔记\Kafka\ES
kibana 安装
kibana 汉化配置
打开 kibana.yml 配置文件,将 i18n.locale: "zh-CN" 即可,
双击 kibana.bat 开启 kibana 输入http://localhost:5601 ,查看 kibana 是否被正常启动。
数据基本操作
数据准备
#准备数据
DELETE /clayindex
PUT /clayindex
{
"mappings": {
"properties": {
"name":{
"type": "keyword"
},
"address":{
"type": "text"
},
"age":{
"type": "integer"
}
}
}
}
#插入数据 可以自己生成id //
POST /clayindex/_doc
{
"name":"曹操",
"address":"魏国",
"age":18
}
POST /clayindex/_doc
{
"name":"贾诩",
"address":"魏国",
"age":19
}
POST /clayindex/_doc
{
"name":"诸葛亮",
"address":"蜀国",
"age":37
}
POST /clayindex/_doc
{
"name":"关羽",
"address":"蜀国",
"age":35
}
POST /clayindex/_doc
{
"name":"周瑜",
"address":["吴国","蜀国"],
"age":25
}
排序
GET clayindex/_doc/_search
{
"query":{
"match": {
"address": "魏国"
}
},
"_source":["name"],
"sort":[
{"age":{"order":"desc"}},
{"name":{"order":"asc"}}
]
}
分页查询
GET clayindex/_doc/_search
{
"query":{
"match": {
"address": "魏国"
}
},
"_source":["name"],
"sort":[
{"age":{"order":"desc"}},
{"name":{"order":"asc"}}
],
"from":0,
"size":10
}
布尔值查询
条件1 and 条件2
GET clayindex/_doc/_search
{
"query":{
"bool": {
"must": [
{
"match": {
"address": "魏国"
}
},{
"match": {
"name": "曹操"
}
}
]
}
},
"_source":["name"],
"sort":[
{"age":{"order":"desc"}},
{"name":{"order":"asc"}}
],
"from":0,
"size":2
}
条件1 or 条件2
GET clayindex/_doc/_search
{
"query":{
"bool": {
"should": [
{
"match": {
"address": "魏国"
}
},{
"match": {
"name": "曹操"
}
}
]
}
},
"_source":["name"],
"sort":[
{"age":{"order":"desc"}},
{"name":{"order":"asc"}}
],
"from":0,
"size":10
}
排除 MUST_NOT
#查询名字不是曹操的信息
GET clayindex/_doc/_search
{
"query":{
"bool": {
"must_not": [
{
"match": {
"name": "曹操"
}
}
]
}
}
}
数据过滤FILTER
gt 大于
gte 大于等于
lt 小于
lte 小于等于!
# 查询名字是曹操,然后年龄大于等于10 小于等于30
GET clayindex/_doc/_search
{
"query":{
"bool": {
"must": [
{
"match": {
"name": "曹操"
}
}
],
"filter": {
"range": {
"age": {
"gte": 10,
"lte": 20
}
}
}
}
}
}
配备多个条件查询
GET clayindex/_doc/_search
{
"query":{
"match":{"address":"吴国 魏国 "}
}
}
高亮查询
GET clayindex/_doc/_search
{
"query":{
"match": {
"name": "曹操"
}
},
"highlight":{
"fields": {
"name": {}
}
}
}
GET clayindex/_doc/_search
{
"query":{
"match": {
"address": "魏国"
}
},
"highlight":{
"fields": {
"address": {}
}
}
}
自定义高亮的风格
GET clayindex/_doc/_search
{
"query":{
"match": {
"name": "曹操"
}
},
"highlight":{
"pre_tags": "<p class='gaoliang'>",
"post_tags": "</p>",
"fields": {
"name": {}
}
}
}
多个条件多个字段高亮查询
GET clayindex/_doc/_search
{
"query":{
"bool": {
"must": [
{
"match": {
"address": "魏国"
}
},{
"match": {
"name": "曹操"
}
}
]
}
},
"highlight":{
"pre_tags": "<p class='gaoliang'>",
"post_tags": "</p>",
"fields": [
{"name": {}},
{"address": {}}
]
}
}
聚合查询
bucket:
数据分组,一些数据按照某个字段进行bucket划分,这个字段值相同的数据放到一个bucket中。类似于Mysql中的group by后的查询结果。
metric:
对一个数据分组执行的统计,比如计算最大值,最小值,平均值等
类似于Mysql中的max(),min(),avg()函数的值,都是在group by后使用的。
数据准备
PUT /music
{
"mappings": {
"properties": {
"id": {
"type": "keyword"
},
"author": {
"type": "text",
"analyzer": "english",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"content": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"language": {
"type": "text",
"analyzer": "english",
"fielddata": true
},
"tags": {
"type": "text",
"analyzer": "english"
},
"length": {
"type": "long"
},
"likes": {
"type": "long"
},
"isRelease": {
"type": "boolean"
},
"releaseDate": {
"type": "date"
}
}
}
}
POST /music/_doc/_bulk
{ "index": {}}
{ "author" : "zhangsan", "name" : "red", "content" : "honda", "language":"ch","tags":"tags","length":3,"likes":10,"isRelease":true,"releaseDate" : "2021-10-28" }
{ "index": {}}
{ "author" : "lisi", "name" : "blue", "content" : "honda", "language":"en","tags":"tags","length":3,"likes":100,"isRelease":true,"releaseDate" : "2021-10-28" }
{ "index": {}}
{ "author" : "zhangsan1", "name" : "red", "content" : "honda", "language":"ch","tags":"tags","length":30,"likes":10,"isRelease":true,"releaseDate" : "2021-11-28" }
{ "index": {}}
{ "author" : "lisi1", "name" : "blue", "content" : "honda", "language":"en","tags":"tags","length":30,"likes":100,"isRelease":true,"releaseDate" : "2021-11-28" }
{ "index": {}}
{ "author" : "zhangsan2", "name" : "red", "content" : "honda", "language":"ch","tags":"tags","length":80,"likes":10,"isRelease":true,"releaseDate" : "2021-11-28" }
{ "index": {}}
{ "author" : "lisi2", "name" : "blue", "content" : "honda", "language":"en","tags":"tags","length":80,"likes":100,"isRelease":true,"releaseDate" : "2022-10-28" }
{ "index": {}}
{ "author" : "zhangsan2", "name" : "red", "content" : "honda", "language":"ch","tags":"tags","length":80,"likes":10,"isRelease":true,"releaseDate" : "2022-10-28" }
{ "index": {}}
{ "author" : "lisi2", "name" : "blue", "content" : "honda", "language":"en","tags":"tags","length":80,"likes":100,"isRelease":true,"releaseDate" : "2022-10-28" }
1 统计目前收录的每种语言的歌曲数量
GET /music/_doc/_search
{
"size": 0,
"aggs": {
"song_qty_by_language": {
"terms": {
"field": "language"
}
}
}
}
返回结果
{
"took" : 8,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 20,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"song_qty_by_language" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "ch",
"doc_count" : 11
},
{
"key" : "en",
"doc_count" : 9
}
]
}
}
}
语法解释:
size:0 表示只要统计后的结果,原始数据不展现,如果是大于0的,则会返回原数据
aggs:固定语法 ,聚合分析都要声明aggs
song_qty_by_language:聚合的名称,可以随便写,建议规范命名
terms:按什么字段进行分组
field:具体的字段名称
2 按语种统计每种语种歌曲的平均时长
GET /music/_doc/_search
{
"size": 0,
"aggs": {
"lang": {
"terms": {
"field": "language"
},
"aggs": {
"length_avg": {
"avg": {
"field": "length"
}
}
}
}
}
}
返回结果
{
"took" : 95,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 40,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"lang" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "ch",
"doc_count" : 21,
"length_avg" : {
"value" : 9.428571428571429
}
},
{
"key" : "en",
"doc_count" : 19,
"length_avg" : {
"value" : 10.105263157894736
}
}
]
}
}
}
PS 两层aggs聚合查询,先按语种统计,得到数据分组,再在数据分组里算平均时长。
3 统计最长时长、最短时长等的歌曲
GET /music/_doc/_search
{
"size": 0,
"aggs": {
"color": {
"terms": {
"field": "language"
},
"aggs": {
"length_avg": {
"avg": {
"field": "length"
}
},
"length_max": {
"max": {
"field": "length"
}
},
"length_min": {
"min": {
"field": "length"
}
},
"length_sum": {
"sum": {
"field": "length"
}
}
}
}
}
}
*** 返回结果***
#! [types removal] Specifying types in search requests is deprecated.
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 40,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"color" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "ch",
"doc_count" : 21,
"length_sum" : {
"value" : 198.0
},
"length_max" : {
"value" : 30.0
},
"length_min" : {
"value" : 3.0
},
"length_avg" : {
"value" : 9.428571428571429
}
},
{
"key" : "en",
"doc_count" : 19,
"length_sum" : {
"value" : 192.0
},
"length_max" : {
"value" : 30.0
},
"length_min" : {
"value" : 3.0
},
"length_avg" : {
"value" : 10.105263157894736
}
}
]
}
}
}
4 按时长分段统计歌曲平均时长
以30秒为一段,看各段区间的平均值。
histogram语法位置跟terms一样,作范围分区,搭配interval参数一起使用
interval:30表示分的区间段为[0,30),[30,60),[60,90),[90,120)
段的闭合关系是左开右闭,如果数据在某段区间内没有,也会返回空的区间。
GET /music/_doc/_search
{
"size": 0,
"aggs": {
"sales_price_range": {
"histogram": {
"field": "length",
"interval": 30
},
"aggs": {
"length_avg": {
"avg": {
"field": "length"
}
}
}
}
}
}
*** 返回结果***
#! [types removal] Specifying types in search requests is deprecated.
{
"took" : 39,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 70,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"sales_price_range" : {
"buckets" : [
{
"key" : 0.0,
"doc_count" : 40,
"length_avg" : {
"value" : 3.0
}
},
{
"key" : 30.0,
"doc_count" : 20,
"length_avg" : {
"value" : 30.0
}
},
{
"key" : 60.0,
"doc_count" : 10,
"length_avg" : {
"value" : 80.0
}
}
]
}
}
}
5 按上架日期分段统计新歌数量
GET /music/_doc/_search
{
"size": 0,
"aggs": {
"sales": {
"date_histogram": {
"field": "releaseDate",
"interval": "month",
"format": "yyyy-MM-dd",
"min_doc_count": 0,
"extended_bounds": {
"min": "2000-10-01",
"max": "2088-12-31"
}
}
}
}
}
返回结果
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 134,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"sales" : {
"buckets" : [
{
"key_as_string" : "2020-10-01",
"key" : 1601510400000,
"doc_count" : 0
},
{
"key_as_string" : "2020-11-01",
"key" : 1604188800000,
"doc_count" : 0
},
{
"key_as_string" : "2020-12-01",
"key" : 1606780800000,
"doc_count" : 0
},
{
"key_as_string" : "2021-01-01",
"key" : 1609459200000,
"doc_count" : 0
},
{
"key_as_string" : "2021-02-01",
"key" : 1612137600000,
"doc_count" : 0
},
{
"key_as_string" : "2021-03-01",
"key" : 1614556800000,
"doc_count" : 0
},
{
"key_as_string" : "2021-04-01",
"key" : 1617235200000,
"doc_count" : 0
},
{
"key_as_string" : "2021-05-01",
"key" : 1619827200000,
"doc_count" : 0
},
{
"key_as_string" : "2021-06-01",
"key" : 1622505600000,
"doc_count" : 0
},
{
"key_as_string" : "2021-07-01",
"key" : 1625097600000,
"doc_count" : 0
},
{
"key_as_string" : "2021-08-01",
"key" : 1627776000000,
"doc_count" : 0
},
{
"key_as_string" : "2021-09-01",
"key" : 1630454400000,
"doc_count" : 0
},
{
"key_as_string" : "2021-10-01",
"key" : 1633046400000,
"doc_count" : 86
},
{
"key_as_string" : "2021-11-01",
"key" : 1635724800000,
"doc_count" : 24
},
{
"key_as_string" : "2021-12-01",
"key" : 1638316800000,
"doc_count" : 0
},
{
"key_as_string" : "2022-01-01",
"key" : 1640995200000,
"doc_count" : 0
},
{
"key_as_string" : "2022-02-01",
"key" : 1643673600000,
"doc_count" : 0
},
{
"key_as_string" : "2022-03-01",
"key" : 1646092800000,
"doc_count" : 0
},
{
"key_as_string" : "2022-04-01",
"key" : 1648771200000,
"doc_count" : 0
},
{
"key_as_string" : "2022-05-01",
"key" : 1651363200000,
"doc_count" : 0
},
{
"key_as_string" : "2022-06-01",
"key" : 1654041600000,
"doc_count" : 0
},
{
"key_as_string" : "2022-07-01",
"key" : 1656633600000,
"doc_count" : 0
},
{
"key_as_string" : "2022-08-01",
"key" : 1659312000000,
"doc_count" : 0
},
{
"key_as_string" : "2022-09-01",
"key" : 1661990400000,
"doc_count" : 0
},
{
"key_as_string" : "2022-10-01",
"key" : 1664582400000,
"doc_count" : 24
},
{
"key_as_string" : "2022-11-01",
"key" : 1667260800000,
"doc_count" : 0
},
{
"key_as_string" : "2022-12-01",
"key" : 1669852800000,
"doc_count" : 0
},
{
"key_as_string" : "2023-01-01",
"key" : 1672531200000,
"doc_count" : 0
},
{
"key_as_string" : "2023-02-01",
"key" : 1675209600000,
"doc_count" : 0
},
{
"key_as_string" : "2023-03-01",
"key" : 1677628800000,
"doc_count" : 0
},
{
"key_as_string" : "2023-04-01",
"key" : 1680307200000,
"doc_count" : 0
},
{
"key_as_string" : "2023-05-01",
"key" : 1682899200000,
"doc_count" : 0
},
{
"key_as_string" : "2023-06-01",
"key" : 1685577600000,
"doc_count" : 0
},
{
"key_as_string" : "2023-07-01",
"key" : 1688169600000,
"doc_count" : 0
},
{
"key_as_string" : "2023-08-01",
"key" : 1690848000000,
"doc_count" : 0
},
{
"key_as_string" : "2023-09-01",
"key" : 1693526400000,
"doc_count" : 0
},
{
"key_as_string" : "2023-10-01",
"key" : 1696118400000,
"doc_count" : 0
},
{
"key_as_string" : "2023-11-01",
"key" : 1698796800000,
"doc_count" : 0
},
{
"key_as_string" : "2023-12-01",
"key" : 1701388800000,
"doc_count" : 0
}
]
}
}
}
6 统计今年每个季度新发布歌曲的点赞数量,以及每个语种的点赞数量
GET /music/_doc/_search
{
"size": 0,
"aggs": {
"sales": {
"date_histogram": {
"field": "releaseDate",
"interval": "quarter",
"format": "yyyy-MM-dd",
"min_doc_count": 0,
"extended_bounds": {
"min": "2022-01-01",
"max": "2022-08-31"
}
},
"aggs": {
"lang_qty": {
"terms": {
"field": "language"
},
"aggs": {
"like_sum": {
"sum": {
"field": "likes"
}
}
}
},
"total" :{
"sum": {
"field": "likes"
}
}
}
}
}
}
返回结果
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 134,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"sales" : {
"buckets" : [
{
"key_as_string" : "2021-10-01",
"key" : 1633046400000,
"doc_count" : 110,
"total" : {
"value" : 5600.0
},
"lang_qty" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "ch",
"doc_count" : 60,
"like_sum" : {
"value" : 600.0
}
},
{
"key" : "en",
"doc_count" : 50,
"like_sum" : {
"value" : 5000.0
}
}
]
}
},
{
"key_as_string" : "2022-01-01",
"key" : 1640995200000,
"doc_count" : 0,
"total" : {
"value" : 0.0
},
"lang_qty" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [ ]
}
},
{
"key_as_string" : "2022-04-01",
"key" : 1648771200000,
"doc_count" : 0,
"total" : {
"value" : 0.0
},
"lang_qty" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [ ]
}
},
{
"key_as_string" : "2022-07-01",
"key" : 1656633600000,
"doc_count" : 0,
"total" : {
"value" : 0.0
},
"lang_qty" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [ ]
}
},
{
"key_as_string" : "2022-10-01",
"key" : 1664582400000,
"doc_count" : 24,
"total" : {
"value" : 1680.0
},
"lang_qty" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "en",
"doc_count" : 16,
"like_sum" : {
"value" : 1600.0
}
},
{
"key" : "ch",
"doc_count" : 8,
"like_sum" : {
"value" : 80.0
}
}
]
}
}
]
}
}
}
7 查询某种语种的歌曲数量
ps 相当于mysql中where与group by联合使用
GET /music/_doc/_search
{
"size": 0,
"query": {
"match": {
"language": "en"
}
},
"aggs": {
"sales": {
"terms": {
"field": "language"
}
}
}
}
8 指定作者的歌与全部歌曲的点赞数量对比。
GET /music/_doc/_search
{
"size": 0,
"query": {
"match": {
"author": "zhangsan"
}
},
"aggs": {
"likes": {
"sum": {
"field": "likes"
}
},
"all": {
"global": {},
"aggs": {
"all_likes": {
"sum": {
"field": "likes"
}
}
}
}
}
}
返回结果
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 28,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"all" : {
"doc_count" : 134,
"all_likes" : {
"value" : 7280.0
}
},
"likes" : {
"value" : 280.0
}
}
}
9 统计近2月,近1月的点赞数
GET /music/_doc/_search
{
"size": 0,
"aggs": {
"recent_60d": {
"filter": {
"range": {
"releaseDate": {
"gte": "now-60d"
}
}
},
"aggs": {
"recent_60d_likes_sum": {
"sum": {
"field": "likes"
}
}
}
},
"recent_30d": {
"filter": {
"range": {
"releaseDate": {
"gte": "now-30d"
}
}
},
"aggs": {
"recent_30d_likes_sum": {
"avg": {
"field": "likes"
}
}
}
}
}
}
返回结果
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 134,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"recent_30d" : {
"meta" : { },
"doc_count" : 134,
"recent_30d_likes_sum" : {
"value" : 54.32835820895522
}
},
"recent_60d" : {
"meta" : { },
"doc_count" : 134,
"recent_60d_likes_sum" : {
"value" : 7280.0
}
}
}
}
10 统计排序
默认按doc_count降序排序,排序规则可以改,order里面可以指定aggs的别名,如length_avg,类似于mysql的order by cnt asc。
计算每种语言的歌曲数量,和每种语言的歌曲平均时长
GET /music/_doc/_search
{
"size": 0,
"aggs": {
"group_by_lang": {
"terms": {
"field": "language",
"order": {
"length_avg": "desc"
}
},
"aggs": {
"length_avg": {
"avg": {
"field": "length"
}
}
}
}
}
}
返回结果
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 134,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"group_by_lang" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "en",
"doc_count" : 66,
"length_avg" : {
"value" : 34.86363636363637
}
},
{
"key" : "ch",
"doc_count" : 68,
"length_avg" : {
"value" : 33.9264705882353
}
}
]
}
}
}