5.1 Multiple Indices
在REST接口需要指定index参数的地方,都可以同时指定多个索引,比如test1,test2,test3,_all,test*,te*t。还可以表达excluce语义,如test*,-test3。
所有索引类API都支持以下几个参数:
ignore_unavailable:忽略指定的索引不存在或者已close
allow_no_indices:忽略带通配符的index参数未匹配任何实际索引
expand_wildcards:确定通配符是否需要扩展为打开索引或闭合索引或两者。
5.2 Date math support in index names
可以通过日期表达式指定一组index name满足特定日期格式的索引
<static_name{date_math_expr{date_format|time_zone}}>
5.3 Common options
以下参数可以添加到所有REST API上:
Pretty Results
添加?pretty=true返回的JSON数据会经过格式化
Human readable output
添加?human=false,返回的数字/时间会以更可读的形式展示,如"1kb", "1h"
Date Math
所有接受格式化日期的地方,都可以接受date math。日期可以为now,或者一个具体的日期字符串以||结尾,接着一下表达式:
+1h 往后一小时
-1d 往前一天
/d round down to the nearest day
例子:
now+1h
2001.02.01||+1M/d 结果为2001-03-01 00:00:00
Response Filtering
通过filter_path可以控制返回的JSON中包含的fields:
filter_path=took,hits.hits._id
filter_path=metadata.indices.*.stat* *替代任意field,或者field name的一部分
filter_path=routing_table.indices.**.state **替代多级fields
filter_path=-_shards -用来剔除