• 查询所有 POST /indexName/typeName/_search
POST /lavector-main0/message/_search
{
    "query": {
        "match_all": {
            
        }
    }
}
  • 条件查询 must 必须包含 should 包含其一 must_not 必须不包含
POST /lavector-main0/message/_search
{
    "query": {
        "bool": {
            "must": [
               {}
            ],
            "should": [
               {}
            ],
            "must_not": [
               {}
            ]
        }
    }
}
  • 具体查询 term 精确匹配 match 模糊匹配 range 范围匹配
POST /lavector-main0/message/_search
{
    "query": {
        "term": {
           "site": "weibo"
        }
    }
}

POST /lavector-main0/message/_search
{
    "query": {
        "match": {
           "content": "奥迪"
        }
    }
}

POST /lavector-main0/message/_search
{
    "query": {
        "range": {
           "tC": {
              "from": "2017-07-01T00:00:00",
              "to": "2017-07-02T00:00:00"
           }
        }
    }
}
  • 组合到一起
POST /lavector-main0/message/_search
{
    "query": {
        "bool": {
            "must": [
               {
                   "term": {
                      "site": "weibo"
                   }
               },
               {
                   "match": {
                      "content": "奥迪"
                   }
               },
               {
                   "range": {
                      "tC": {
                         "from": "2017-07-01T00:00:00",
                         "to": "2017-07-02T00:00:00"
                      }
                   }
               }
               
            ]
        }
    }
}