ElasticSearch搜索数据到底有几种方式?

Elasticsearch允许三种方式执行搜索请求:

GET请求正文:

curl -XGET "http://localhost:9200/app/users/_search" -d '{ "query": { "term": { "email": "[email protected]" } } }'

POST请求正文:

由于并非所有客户端都支持使用正文GET,因此也允许使用POST。

curl -XPOST "http://localhost:9200/app/users/_search" -d '{ "query": { "term": { "email": "[email protected]" } } }'

GET没有请求正文:

curl -XGET "http://localhost:9200/app/users/_search?q=email:[email protected]" 或(如果您想手动对您的查询字符串进行URL编码)

curl -XGET "http://localhost:9200/app/users/_search?q=email%3Afoo%40gmail.com"

参考 :http://www.elasticsearch.org/guide/reference/api/search/uri-request/

猜你喜欢

转载自www.cnblogs.com/sunsky303/p/10063030.html