一些es查询的资料

一种chrome es查询插件:Elasticvue

Elasticsearch复杂查询语法总结

NativeSearchQueryBuilder多条件查询方法 :不要连续使用多个withQuery,会会覆盖。

ES数组类型字段搜索以及数组空值搜索 :
每个字段都可以包含零个或多个值,但是所有值必须具有相同的数据类型。
e.g. : https://blog.csdn.net/asdksd/article/details/126750603

聚合查询:
Java Elasticsearch 聚合查询(Aggregation)详解
嵌套聚合:
ElasticSearch聚合查询小例子

解决聚合查询至多返回10个bucket的问题 :
关于在elasticSearch中使用聚合查询后只显示10个bucket的问题

TermsAggregationBuilder ab1 = AggregationBuilders.terms("groupByAreaLevel").field(arealLevelField).size(500) //不然顶多10个bucket

解决查询数据默认返回10条的问题:
在使用elasticsearch的rest api查询index数据时默认返回10条

NativeSearchQuery nativeSearchQuery = new NativeSearchQueryBuilder().withMaxResults(10000) //不然顶多返回10条
                        .withQuery(queryBuilder).build();

不过当我设置为更大的值,比如20000时报错了:
Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]; nested exception is ElasticsearchStatusException[Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=Result window is too large, from + size must be less than or equal to: [10000] but was [20000]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting.]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=Result window is too large, from + size must be less than or equal to: [10000] but was [20000]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting.]]
记录在此,暂不继续深入。

Elasticsearch Top hits Aggregation :
Elasticsearch Top hits Aggregation
ElasticSearch 学习笔记:聚合(Aggregation) - Top Hits:功能简介:
聚合后,每一个聚合Bucket里面仅返回指定顺序的前N条数据

  • 19
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qq_23204557

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值