一、索引
1.1 创建一个空索引
PUT template_rollover_info-0
{
}
1.1 创建一个索引并同时写入数据
添加文档时,防止覆盖已存在的文档,可以通过_create加以限制。
PUT /TSTTST/_doc/2/ _create
{
"NAME": "TST"
}
1.2创建一个索引并同时添加别名、别名添加属性
PUT /template_rollover_info-0
{
"aliases": {
"template_rollover_info_alias": {
"is_write_index": true
}
}
}
重命名
POST _reindex { "source": { "index": "old_name" }, "dest": { "index": "new_name" } }
2.查询索引的文档数
GET /template_rollover_info-*/_count
2.1 查询索引数据
GET template_rollover_info_alias/_search
get TST_basic_info/_search
2.2 terms 查询
GET XXX_YYYalias_TST_basic_info/_search
{
"query": {
"terms" : { "TSTId" : {
"index" : "XXX_YYYalias_P_role",
"id" : "63102010803202008372000001B201658033581948947001",
"path" : "TSTId"
}}
}
}
3. 根据索引名 模糊查询 索引概要
GET _cat/indices/tem*?v
GET _cat/indices/*plan*?v
4. 查看索引定义
get template_rollover_info-00*
4. 删除单个索引
DELETE kibana_sample_data_ecommerce15
5. 删除多个索引
DELETE kibana_sample_data_ecommerce*
6. 范围查询索引
GET XXX/_search
{
"query": {
"range": {
"cardValidityEndDate":{"gt":35, "lt": 50}
}
}
}
- 查询结果返回_version 字段
GET student/_search{
"query": {
"match": {
"age": "12"
}
},
"version": true}
GET /索引库名 查看索引下有哪些类型(7版本之前)
二、 别名
GET _cat/indices?v
1. 查看template_rollover开头的别名
(alias index filter routing.index routing.search is_write_index)
GET _cat/aliases/template_rollover*?v
一个别名对应多个索引
2. 查看template_rollover_info_alias对应哪些索引及索引的定义
GET template_rollover_info_alias
3. 查看所有别名及别名对应索引
GET */_alias/*
4. 删除某个索引别名
DELETE template_rollover_info/_alias/template_rollover_info_alias
5. 查看索引与别名关系
你可以检测这个别名指向哪一个索引:
GET /*/_alias/my_index
拷贝为 cURL在 Sense 中查看
或哪些别名指向这个索引:
GET /my_index_v1/_alias/*
拷贝为 cURL在 Sense 中查看
两者都会返回下面的结果:
6.给索引添加别名
POST _aliases
{
"actions": [
{
"add": {
"index": "indexName ",
"alias": " aliasName"
}
}
]
}
查看所有索引
GET _cat/indices?v&s=index:asc
GET /_cat/nodes?v GET /_cat/indices GET /kibana_sample_data_ecommerce/_settings GET /kibana_sample_data_ecommerce/_mapping GET /_cat/indices?v&h=health,status,index GET _template GET _template/cus* GET _cat/templates?v GET _alias GET _alias/ GET _cat/aliases es 别名: https://www.cnblogs.com/niutao/p/10908981.html es没有修改别名的操作,只能先删除后添加 ROLLOVER:一个别名指向多个索引时,其中一个会通过is_write_index =true来表示写索引. 可以将起始别名此项设置为true POST /test*/_forcemerge POST /_forcemerge?flush=true |
三、 模板
1. 查看tem开头的模板概要
(name index_patterns order version)
GET _cat/templates/tem*?v
1. 查看具体模板概要
GET _cat/templates/template_rollover_info?v
2. 查看具体模板定义
GET _template/template_rollover_info
GET _template/template_rollover*
3. 删除 template_rollover_info_alias 模板
DELETE _template/template_rollover_info_alias
DELETE _template/template_rollover_info
四、 段
强制归并 segment
POST /_forcemerge
负载较低的时间段,通过 forcemerge 接口,强制归并 segment。
查看段内存大小
GET /_cat/segments?v
curl -s -uelastic:changeme 'http://IP:9200/_cat/nodes?v&h=segments.count,segments.memory,segments.index_writer_memory,segments.version_map_memory,segments.fixed_bitset_memory'
找到答案了,es删除索引后只是把索引标记为已删除,需要手动执行forcemerge才会真正的删除掉。
POST /kibana_sample_data_ecommerce-*/_forcemerge
POST /_forcemerge
GET /_cat/segments/P_summary?v
- 分片
GET /_cat/shards/P_summary?v
改变分片数
7版本以上的elasticsearch吧,默认只允许1000个分片,
PUT /_cluster/settings
{"transient":{
"cluster":{
"max_shards_per_node":10000}}}
现在在elasticsearch.yml中定义
> cluster.max_shards_per_node: 10000
貌似也不生效,默认就允许创建1000个分片,我是在kibana的tools中改变临时设置
查看所有分片
GET _cat/shards
六 、 rollover
rollover
PUT /template_rollover_info-0
{
"aliases": {
"template_rollover_info_alias": {
"is_write_index": true
}
}
}
POST /template_rollover_info_alias/_rollover
{
"conditions": {
"max_age": "30s",
"max_docs": 50,
"max_size": "5kb"
}
}
1. 为true 时, scheduled:0/30 * * * * ? 定时间隔大余 addMaxIndexAgeCondition
否则会报新索引存在;
2. 为true时, 定时间隔 可以随意
另外:template_rollover_info_alias 使用同一别名过程中,scheduled 和 Condition 不要变化、否则会出现一些错误,报新索引存在 的可能性比较大
七、DSL数据查询
GET _search
{
"query": {
"match_all": {}
}
}
POST P_summary/_search
{
}
POST P_summary/_search
{
"query": {
"bool": {
"must": [
{
"term": {
"PNo": "111112"
}
}
],
"must_not": [ ],
"should": [ ]
}
},
"from": 0,
"size": 10,
"sort": [{"flowTime":"desc"}],
"aggs": { }
}
YYY排查用
POST TST_basic_info/_search { "query": { "bool": { "must": [ { "term": { "businessNo": "6420110101020190000144" } } ], "must_not": [ ], "should": [ ] } }, "from": 0, "size": 10, "sort": [{"flowTime":"desc"}], "aggs": { } } POST P_summary/_search { "query": { "bool": { "must_not": [ ], "should": [ ] } }, "from": 0, "size": 10, "sort": [ {"flowTime":"desc"}], "aggs": { } } |
八、排序
九、reindex
reindex 详解:
elasticsearch 基础 —— ReIndex
https://blog.csdn.net/ctwy291314/article/details/82734667
只要环境可访问,则可以在任何版本之间对数据进行reindex,那么这也是版本es升级的数据迁移不错的选择
注意:reindex,需要事先建立好mapping,否则会出现莫名其妙的问题。
POST _reindex
{
"source": {
"index": "TST_basic_info"
},
"dest": {
"index": "YYY_TST_basic_info"
}
}
elasticsearch实现远程索引复制
https://blog.csdn.net/lpp_dd/article/details/78554839
{
"took" : 8610,
"timed_out" : false,
"total" : 59575,
"updated" : 0,
"created" : 59575,
"deleted" : 0,
"batches" : 60,
"version_conflicts" : 0,
"noops" : 0,
"retries" : {
"bulk" : 0,
"search" : 0
},
"throttled_millis" : 0,
"requests_per_second" : -1.0,
"throttled_until_millis" : 0,
"failures" : [ ]
}
索引迁移
POST _reindex
{
"conflicts": "proceed",
"source": {
"index": "twitter"
},
"dest": {
"index": "new_twitter",
"op_type": "create"
}
}
"op_type": "create" :主键存在时不覆盖
POST _reindex
{
"source": {
"index": "source",
"size": 5000
},
"dest": {
"index": "dest",
"routing": "=cat"
}
}
slices 使用
POST _reindex?slices=5&refresh
{
"source": {
"index": "twitter"
},
"dest": {
"index": "new_twitter"
}
}
op_type和conflicts
十、 分片
https://blog.csdn.net/qq_38486203/article/details/80077844
分片个数是越多越好,还是越少越好了?根据整个索引的数据量来判断。
实列场景:
如果 IndexA 所有数据文件大小是300G,改怎么定制方案了?(可以通过Head插件来查看)
分片建议:(仅参考)
1、每一个分片数据文件小于30GB
2、每一个索引中的一个分片对应一个节点
3、节点数大于等于分片数
- 1
- 2
- 3
- 4
- 5
- 6
- 7
根据建议,至少需要 10 个分片。
结果: 建10个节点 (Node),Mapping 指定分片数为 10,满足每一个节点一个分片,每一个分片数据带下在30G左右。
SN(分片数) = IS(索引大小) / 30
NN(节点数) = SN(分片数) + MNN(主节点数[无数据]) + NNN(负载节点数)
分片查询
我们可以指定es去具体的分片查询从而进一步的实现es极速查询。
- randomizeacross shards
随机选择分片查询数据,es的默认方式
- _local
优先在本地节点上的分片查询数据然后再去其他节点上的分片查询,本地节点没有IO问题但有可能造成负载不均问题。数据量是完整的。
- _primary
只在主分片中查询不去副本查,一般数据完整。
- _primary_first
优先在主分片中查,如果主分片挂了则去副本查,一般数据完整。
- _only_node
只在指定id的节点中的分片中查询,数据可能不完整。
- _prefer_node
优先在指定你给节点中查询,一般数据完整。
- _shards
在指定分片中查询,数据可能不完整。
- _only_nodes
reindex的核心做跨索引、跨集群的数据迁移。
慢的原因及优化思路无非包括:
1)批量大小值可能太小。
需要结合堆内存、线程池调整大小;
2)reindex的底层是scroll实现,借助scroll并行优化方式,提升效率;
3)跨索引、跨集群的核心是写入数据,考虑写入优化角度提升效率。
、Task API 操作
1、使用Task API查看reindex的情况
GET _tasks?detailed=true&actions=*reindex
状态如下:可知道当前的taskId = 9620804
2、使用TaskId查看执行的状态
3、使用Cancel Task API取消正在执行的reindex操作
取消操作可能需要几秒钟的时间,取消方式如下:
POST _tasks/task_id:9620804/_cancel
4、使用Task API 重置reindex的节流限制
POST _reindex/task_id:9620804/_rethrottle?requests_per_second=-1
、并行化执行reindex操作
1、手动并行化
如下是两个slices的手动并行化reindex:
10 scroll
GET /P_summary/_search?scroll=1m
{
"query": { "match_all": {}},
"sort" : ["_doc"],
"size": 1000
}
POST /_search/scroll
{
"scroll" : "1m",
"scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAJpKuEWSHQxUFdlMGlRci1NWEV5Mi1Hc2ctUQ=="
}
参数 search_type=scan 被移除,参考
十一、
十二、
十三、 更新
更新字段
通过脚本更新制定字段,其中ctx是脚本语言中的一个执行对象,先获取_source,再修改content字段
POST blog/_doc/1/_update
{
"script": {
"source": "ctx._source.content=\"从官网下载VMware-workstation,双击可执行文件进行安装...\""
}
}
注:blog/_doc/1/_update 其中:_doc也可以是具体的类型名称(ES7之前的版本)
添加字段
POST blog/_doc/1/_update
{
"script": {
"source": "ctx._source.author=\"chengyuqiang\""
}
}
删除字段
POST blog/_doc/1/_update
{
"script": {
"source": "ctx._source.remove(\"url\")"
}
}
十四、refresh flush
立即刷新、文档可见
这些将创建一个文档并立即刷新索引,使其可见:
DELETE
PUT /_doc/1?refresh
{"message": "测试文档1"}
PUT /_doc/2?refresh=true
{"message": "测试文档2"}
不刷新
这些将创建一个文档而不做任何使搜索可见的内容:
PUT /_doc/3
{"message": "测试文档3"}
PUT /_doc/4?refresh=false
{"message": "测试文档4"}
等待刷新可见
PUT /_doc/5?refresh=wait_for
{"message": "测试文档5"}
flush 和 refresh 区别
十五、_ilm
https://blog.csdn.net/wyz0516071128/article/details/102709606、
查看 XXX_*开头索引的策略
GET XXX_*/_ilm/explain
ilm状态查看
GET _ilm/status
return
{
"operation_mode": "RUNNING"
}
ilm所有策略查看
GET _ilm/P
ilm 更新、查看 转换、启动、关闭
参考https://blog.csdn.net/vkingnew/article/details/91962002
十六、_field_caps
GET _field_caps?fields=agreementCode,PStatus
十七、profile
GET XXX_YYYalias_TST_basic_info/_search { "from":0, "size":100, "query":{ "bool":{ "must":[ { "term":{ "identifyNumber":{ "value":"2C8I0D65e6e6562020dd7aa706f323e45b3d3c216bfb5a755ce70e696761dbe86538c1d2", "boost":1 } } }, { "term":{ "identifyType":{ "value":"01", "boost":1 } } }, { "term":{ "name":{ "value":"白云玲", "boost":1 } } } ], "adjust_pure_negative":true, "boost":1 } }, "sort":[ { "businessTime":{ "order":"desc" } } ] } |
返回:
{ "took" : 355, "timed_out" : false, "_shards" : { "total" : 18, "successful" : 18, "skipped" : 0, "failed" : 0 }, "hits" : { "total" : { "value" : 0, "relation" : "eq" }, "max_sXXX" : null, "hits" : [ ] } } |
加上profile
GET XXX_YYYalias_TST_basic_info/_search { "from":0, "size":100, "profile": true, "query":{ "bool":{ "must":[ { "term":{ "identifyNumber":{ "value":"2C8I0D65e6e6562020dd7aa706f323e45b3d3c216bfb5a755ce70e696761dbe86538c1d2", "boost":1 } } }, { "term":{ "identifyType":{ "value":"01", "boost":1 } } }, { "term":{ "name":{ "value":"白云玲", "boost":1 } } } ], "adjust_pure_negative":true, "boost":1 } }, "sort":[ { "businessTime":{ "order":"desc" } } ] } |
返回:
....
Profile API响应说明
Query
Query 段由构成Query的元素以及它们的时间信息组成。Profile API结果中Query 部分的基本组成是:
query type :显示哪种类型的查询被触发。
time: lucene执行此查询所用的时间。单位是毫秒。
time_in_nanos – 执行此查询所用的时间。单位是纳秒。
breakdown – 有关查询的更详细的细节,主要与lucene参数有关。
children – 具有多个关键字的查询被拆分成相应术语的布尔查询,每个查询都作为单独的查询来执行。每个子查询的详细信息将填充到Profile API输出的子段中。
Rewrite Time
由于多个关键字会分解以创建个别查询,所以在这个过程中肯定会花费一些时间。将查询重写一个或多个组合查询的时间被称为“重写时间”。(以纳秒为单位)。
Collectors
在Lucene中,收集器是负责收集原始结果,收集和组合结果,执行结果排序等的过程。
————————————————
版权声明:本文为CSDN博主「机器熊技术大杂烩」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/majianxiong_lzu/article/details/90441624
Profile API响应说明:
上面的响应显示的是单个分片。每个分片都被分配一个唯一的ID,ID的格式是[nodeID][indexName][shardID]。现在在"shards"数组里还有另外三个元素,它们是:
query
rewrrite_time
collector
Query
Query 段由构成Query的元素以及它们的时间信息组成。Profile API结果中Query 部分的基本组成是:
type —— 它向我们显示了哪种类型的查询被触发。此处是布尔值。因为多个关键字匹配查询被分成两个布尔查询。
description —— 该字段显示启动查询的lucene方法。这里是 "author:鲁 author:迅"
time —— lucene 执行此查询所用的时间。单位是毫秒。
time_in_nanos —— lucene 执行此查询所用的时间。单位是微秒。
breakdown —— 有关查询的更详细的细节,主要与lucene参数有关。
children —— 具有多个关键字的查询被拆分成相应术语的布尔查询,每个查询都作为单独的查询来执行。每个子查询的详细信息将填充到Profile API输出的子段中。在上面的章节中,可以看到第一个子元素查询是"鲁",下面给出查询时间和其他breakdown参数等详细信息。同样,对于第二个关键字,有一个名为"迅"的子元素具有与其兄弟相同的信息。从查询中的子段中,我们可以得到关于哪个搜索项在总体搜索中造成最大延迟的信息。
Rewrite Time
由于多个关键字会分解以创建个别查询,所以在这个过程中肯定会花费一些时间。将查询重写一个或多个组合查询的时间被称为“重写时间”。(以纳秒为单位)。
Collectors
在Lucene中,收集器是负责收集原始结果,收集和组合结果,执行结果排序等的过程。例如,在上面的执行的查询中,当查询语句中给出size:0时,使用的收集器是"totalHitCountCollector"。这只返回搜索结果的数量(search_count),不返回文档。此外,收集者所用的时间也一起给出了。
————————————————
版权声明:本文为CSDN博主「李京京」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/lijingjingchn/article/details/88896389
十八、mapping
创建mapping
PUT XXX_YYY_summary_TST-000000/ { "mappings" : { "properties" : { "accountList" : { "type" : "nested", "properties" : { "accountName" : { "type" : "keyword" }, "accountNo" : { "type" : "keyword" }, "bankBranchName" : { "type" : "keyword" } } }, "addressList" : { "type" : "nested", "properties" : { "address" : { "type":"keyword","index":false }, "addressType" : { "type" : "keyword" }, "cityCode" : { "type" : "keyword" }, "provinceCode" : { "type" : "keyword" }, "townCode" : { "type" : "keyword" } } }, "birthday" : { "type" : "keyword" }, "cardValidityEndDate" : { "type" : "date" }, "cardValidityStartDate" : { "type" : "date" }, "contactList" : { "type" : "nested", "properties" : { "contactType" : { "type" : "keyword" }, "contactValue" : { "type" : "keyword" } } }, "createTime" : { "type" : "date" }, "TSTFlag" : { "type" : "nested", "properties" : { "TSTFlag" : { "type" : "keyword" }, "TSTLevel" : { "type" : "keyword" }, "TSTType" : { "type" : "keyword" }, "isCarClaim" : { "type" : "boolean" }, "isCarTST" : { "type" : "boolean" }, "isNoCarClaim" : { "type" : "boolean" }, "isNoCarTST" : { "type" : "boolean" }, "totalClaimAmount" : { "type" : "double" } } }, "TSTId" : { "type" : "keyword" }, "degree" : { "type" : "keyword" }, "gender" : { "type" : "keyword" }, "identifyNumber" : { "type" : "keyword" }, "identifyType" : { "type" : "keyword" }, "isSocialInsurance" : { "type" : "keyword" }, "mdmId" : { "type" : "keyword" }, "name" : { "type" : "keyword" }, "nationnality" : { "type":"keyword","index":false }, "occupationCode" : { "type" : "keyword" }, "occupationType" : { "type" : "keyword" }, "otherIdList" : { "type" : "nested", "properties" : { "deviceId" : { "type" : "keyword" }, "deviceType" : { "type" : "keyword" }, "openId" : { "type" : "keyword" }, "unionId" : { "type" : "keyword" } } }, "PRoleList" : { "type" : "nested", "properties" : { "PNo" : { "type" : "keyword" }, "PRole" : { "type" : "keyword" } } }, "postCode" : { "type" : "keyword" }, "riskLevel" : { "type" : "keyword" }, "socialRegistrationNumber" : { "type" : "keyword" }, "systemIdList" : { "type" : "nested", "properties" : { "systemId" : { "type" : "keyword" } } }, "thirdPartyIdList" : { "type" : "nested", "properties" : { "systemId" : { "type" : "keyword" }, "thirdPartyId" : { "type" : "keyword" } } }, "updateTime" : { "type" : "date" } } } } |
十九、聚合查询
聚合查询返回部分字段
POST core_aaalias_summary_customer/_search
{
"_source": [ "customerId.*", "cardValidityEndDate.*" ],
"query": {
"bool": {
"must": [
{
"range":{
"cardValidityEndDate":{
"gt":"1177808000000",
"lt":"1582992000000"
}
}
}
],
"must_not": [ ],
"should": [ ]
}
},
"from": 0,
"size": 10,
"sort": [{"customerId":"desc"}],
"aggs": {
"cid":{
"terms": {
"field": "customerId",
"size": 10
}
}
}
}
添加 _source 参数,可让 ES 不返回命中文档,而只返回查询的统计,或者只返回一部分的字段。对于单个文档较大的情景特备适用。 不返回文档 GET /_search { "_source": false, "query" : { "term" : { "user" : "kimchy" } } } 返回部分字段 GET /_search { "_source": "obj.*", "query" : { "term" : { "user" : "kimchy" } } } 或者 GET /_search { "_source": [ "obj1.*", "obj2.*" ], "query" : { "term" : { "user" : "kimchy" } } } 更精确地方法 指定包含哪些以及不包含哪些字段 GET /_search { "_source": { "includes": [ "obj1.*", "obj2.*" ], "excludes": [ "*.description" ] }, "query" : { "term" : { "user" : "kimchy" } } } 还有另外一个参数 stored_fields 也能筛选字段,官方文档并不建议适用。 ———————————————— 版权声明:本文为CSDN博主「afeiqiang」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/afeiqiang/article/details/82999962 |
Elasticsearch Cat 命令
https://blog.csdn.net/wangpei1949/article/details/82287444
单节点分配信息
_cat/allocation
cat repositories
repositories 可以显示集群中的快照的资料库
**、Elasticsearch 分片以及生命周期
1)客户端发起数据写入请求,对你写的这条数据根据_routing规则选择发给哪个Shard。
²确认Index Request中是否设置了使用哪个Filed的值作为路由参数,
²如果没有设置,则使用Mapping中的配置,
²如果mapping中也没有配置,则使用_id作为路由参数,然后通过_routing的Hash值选择出Shard,最后从集群的Meta中找出出该Shard的Primary节点。
2)写入请求到达Shard后,先把数据写入到内存(buffer)中,同时会写入一条日志到translog日志文件中去。
²当写入请求到shard后,首先是写Lucene,其实就是创建索引。
²索引创建好后并不是马上生成segment,这个时候索引数据还在缓存中,这里的缓存是lucene的缓存,并非Elasticsearch缓存,lucene缓存中的数据是不可被查询的。
3)执行refresh操作:从内存buffer中将数据写入os cache(操作系统的内存),产生一个segment file文件,buffer清空。
²写入os cache的同时,建立倒排索引,这时数据就可以供客户端进行访问了。
²默认是每隔1秒refresh一次的,所以es是准实时的,因为写入的数据1秒之后才能被看到。
²buffer内存占满的时候也会执行refresh操作,buffer默认值是JVM内存的10%。
²通过es的restful api或者java api,手动执行一次refresh操作,就是手动将buffer中的数据刷入os cache中,让数据立马就可以被搜索到。
²若要优化索引速度, 而不注重实时性, 可以降低刷新频率。
4)translog会每隔5秒或者在一个变更请求完成之后,将translog从缓存刷入磁盘。
²translog是存储在os cache中,每个分片有一个,如果节点宕机会有5秒数据丢失,但是性能比较好,最多丢5秒的数据。。
²可以将translog设置成每次写操作必须是直接fsync到磁盘,但是性能会差很多。
²可以通过配置增加transLog刷磁盘的频率来增加数据可靠性,最小可配置100ms,但不建议这么做,因为这会对性能有非常大的影响。
5)每30分钟或者当tanslog的大小达到512M时候,就会执行commit操作(flush操作),将os cache中所有的数据全以segment file的形式,持久到磁盘上去。
²第一步,就是将buffer中现有数据refresh到os cache中去。
²清空buffer 然后强行将os cache中所有的数据全都一个一个的通过segmentfile的形式,持久到磁盘上去。
²将commit point这个文件更新到磁盘中,每个Shard都有一个提交点(commit point), 其中保存了当前Shard成功写入磁盘的所有segment。
²把translog文件删掉清空,再开一个空的translog文件。
²flush参数设置:
Øindex.translog.flush_threshold_period:
Øindex.translog.flush_threshold_size:
Ø#控制每收到多少条数据后flush一次
Øindex.translog.flush_threshold_ops:
6)Segment的merge操作:
²随着时间,磁盘上的segment越来越多,需要定期进行合并。
²Es和Lucene 会自动进行merge操作,合并segment和删除已经删除的文档。
²我们可以手动进行merge:POST index/_forcemerge。一般不需要,这是一个比较消耗资源的操作。
附:、释义:
1 2 3 4 5 | { "index" : "TST" } |
其中 acknowledged 表示是否在集群成功创建索引,同时 shards_acknowledged 表示是否在超时之前成功创建运行必要的分片。
注意 acknowledged 和 shards_acknowledged 可能返回 false,但是索引创建成功。这些值只是表明是否操作在超时之前完成。如果 acknowledged 是 false,表示我们对集群更新新创建的索引操作超时,但它可能很快将被创建。如果 shards_acknowledged 是 false,表示我们必要的分片启动操作超时(默认只为主分片),即使集群成功更新新创建的索引。
2020 1-2月费用
GET XXX/_search
{
"query": {
"bool": {
"must": [
{
"range": {
"flowTime": {
"gt": "1577808000000",
"lt": "1582992000000"
}
}
}
],
"must_not": [ ],
"should": [ ]
}
},
"from": 0,
"size": 10,
"sort": [ ],
"aggs": {
"intraday_return" : { "sum" : { "field" : "fee" } }
}
}