0
点赞
收藏
分享

微信扫一扫

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

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

GET请求正文:

curl -XGET "​​http://localhost:9200/app/users/_search"​​​ -d '{ "query": { "term": { "email": ​​"foo@gmail.com​​" } } }'

POST请求正文:

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

curl -XPOST "​​http://localhost:9200/app/users/_search"​​​ -d '{ "query": { "term": { "email": ​​"foo@gmail.com​​" } } }'

GET没有请求正文:

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

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

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

 

作者:​​sunsky303​​​



举报

相关推荐

0 条评论