各种query搜索语法

各种query搜索语法
1、match all

GET /_search
{
​ “query”: {
​ “match_all”: {}
​ }
}

2、match (会对查询的条件进行分词,然后再进行查询)

GET /_search
{
​ “query”: { “match”: { “title”: “my elasticsearch article” }}
}

3、multi match

GET /test_index/test_type/_search
{
“query”: {
​ “multi_match”: {
​ “query”: “test”,
​ “fields”: [“test_field”, “test_field1”]
​ }
}
}

4、range query

GET /company/employee/_search
{
“query”: {
​ “range”: {
​ “age”: {
​ “gte”: 30
​ }
​ }
}
}

5、term query ( 是把 test_field 的值,当做一个整体进行进行查询,不会对其进行分词)

GET /test_index/test_type/_search
{
“query”: {
​ “term”: {
​ “test_field”: “test hello”
​ }
}
}

6、terms query

GET /_search
{
​ “query”: { “terms”: { “tag”: [ “search”, “full_text”, “nosql” ] }}
}

7、exist query(2.x中的查询,现在已经不提供了)
打赏
  • 版权声明: 本博客所有文章除特别声明外,著作权归作者所有。转载请注明出处!
  • © 2020 John Doe
  • Powered by Hexo Theme Ayer
  • PV: UV:

请我喝杯咖啡吧~

支付宝
微信