term的多种查询

es查询总结

关键字 用处
term 精准查询
exists 特定字段非空
prefix 包含前缀
wildcard 通配符查询
regexp 正则表达式查询(
ids 多值查询

范围查询

es查询总结
gte—lte
范围为时间时,用format"dd-MM-yyyy"

布尔查询

es查询总结

type description
must(must_not) 必须(必须不)出现在匹配⽂档中
filter 必须出现在⽂档中,但是不打分
must_not 不能出现在⽂档中
should 应该出现在⽂档中(可配合配合minimum_should_match=?)

排序查询

es查询总结
desc降序,asc升序

聚合查询(指标聚合,桶聚合)

es查询总结
es查询总结
指标聚合:对⼀个数据集求最⼤、最⼩、和、平均值等指标的聚合
桶聚合:对查询出的数据进⾏分组group by,再在组上进行指标聚合。

type description
Cardinality 去重
stats 同时统计count,max,min,avg,sum5个值
Extended 比stats多四个值:平方和,方差,标准差,平均值加/减标准差
pecentiles 占比[ 1, 5, 25, 50, 75, 95, 99 ]分位上的百分位统计

query_string查询

es查询总结
单个字段 default_field
多个字段 fields

索引别名

es查询总结
新增别名 add
删除别名 remove
重命名 add,remove

重建索引

  1. nba取⼀个别名nba_latest, nba_latest作为对外使⽤
  2. 新增⼀个索引nba_20220101,结构复制于nba索引,根据业务要求修改字段
  3. 将nba数据同步到nba_20220101
    es查询总结
  4. 给nba_20220101添加别名nba_latest,删除nba别名nba_latest
    es查询总结
  5. 删除nba索引

高亮查询

es查询总结

相关文章:

  • 2021-11-24
  • 2021-10-27
  • 2021-09-21
  • 2020-06-10
  • 2021-06-06
  • 2022-02-09
  • 2021-06-02
  • 2022-02-25
猜你喜欢
  • 2022-01-19
  • 2021-07-20
  • 2022-01-24
  • 2021-06-25
  • 2021-10-01
  • 2019-06-01
  • 2022-12-23
相关资源
相似解决方案