Elasticsearch提供了一些通用查询参数,可以用于所有REST API的查询使用
1.pretty
是否美观的显示查询结果,即对JSON数据进行格式化显示
普通请求:
GET /spring-elasticsearch-demo/_search HTTP/1.1
Host: localhost:9200
cache-control: no-cache
Postman-Token: 50167740-fc2b-492e-be16-51e760426094
{"took":2,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":1,"max_score":1.0,"hits":[{"_index":"spring-elasticsearch-demo","_type":"person","_id":"2","_score":1.0,"_source":{"id":"2","name":"大大","description":"天天向上","age":1,"create":1535760000000}}]}}
此时,JSON数据是没有任何空格、缩进的
pretty请求:
GET /spring-elasticsearch-demo/_search?pretty HTTP/1.1
Host: localhost:9200
cache-control: no-cache
Postman-Token: 8a70e5d8-b674-4