Elastic Search Api 通用选项
优化返回显示
?pretty=true ?format=yaml
人类可读的
?human=false
显示信息头
如 _cat 等,可以返回信息头
v=true
index shard time type stage source_host source_node target_host target_node repository snapshot files files_recovered files_percent files_total bytes bytes_recovered bytes_percent bytes_total translog_ops translog_ops_recovered translog_ops_percent my-index-000001 0 13ms store done n/a n/a 127.0.0.1 node-0 n/a n/a 0 0 100% 13 0b 0b 100% 9928b 0 0 100.0%
响应信息过滤
使用 filter_path 可以控制返回的信息,避免信息过多, 支持 * 只能匹配
curl -X GET "localhost:9200/_search?q=kimchy&filter_path=took,hits.hits._id,hits.hits._score&pretty"
curl -X GET "localhost:9200/_cluster/state?filter_path=metadata.indices.*.stat*&pretty"
排除字段 -
curl -X GET "localhost:9200/_count?filter_path=-_shards&pretty"
错误栈信息显示
但请求有问题时,可以查看错误详情
curl -X POST "localhost:9200/my-index-000001/_search?size=surprise_me&error_trace=true&pretty"
Flat setting 扁平化
curl -X GET "localhost:9200/my-index-000001/_settings?flat_settings=true&pretty" { "my-index-000001" : { "settings": { "index.number_of_replicas": "1", "index.number_of_shards": "1", "index.creation_date": "1474389951325", "index.uuid": "n6gzFZTgS664GUfx0Xrpjw", "index.version.created": ..., "index.routing.allocation.include._tier_preference" : "data_content", "index.provided_name" : "my-index-000001" } } }

浙公网安备 33010602011771号