Elasticserch学习之查询字符串

示例 1:查询所有类型为 tweet并在 tweet字段中包含 elasticsearch字符的文档。

GET /_all/tweet/_search?q=tweet:elasticsearch

示例 2:查找 name字段中包含"john"和 tweet字段包含"mary"的结果。

+name:john +tweet:mary
编码后:
GET /_search?q=%2Bname%3Ajohn+%2Btweet%3Amary

示例 3:返回包含"mary"字符的所有文档的简单搜索。

GET /_search?q=mary

示例 4:更复杂的搜索。

_all field

  • name字段包含"mary""john"
  • date晚于2014-09-10
  • _all字段包含"aggregations""geo"
+name:(mary john) +date:>2014-09-10 +(aggregations geo)

编码后:

 GET /_search?q=%2Bname%3A(mary+john)+%2Bdate%3A%3E2014-09-10+%2B(aggregations+geo)

猜你喜欢

转载自www.cnblogs.com/mentiantian/p/10556685.html