es的分頁、高亮、排序查詢

POST kibana_sample_data_flights-1227/_search
{
  "from": 0,
  "size": 20, 
  "query": {
    "match": {
      "DestRegion": "SE"
    }
  },
  "highlight": {
    "fields": {
      "DestRegion": {}
    },
    "pre_tags": "ffd",
    "post_tags": "fdfdf",
    "fragment_size": 10
  },
  "sort": [
    {
      "timestamp": {
        "order": "desc"
      }
    }
  ]
}

#嵌套,實現了 should not 邏輯
POST /products/_search
{
  "query": {
    "bool": {
      "must": {
        "term": {
          "price": "200"
        }
      },
      "should": [
        {
          "bool": {
            "must_not": {
              "term": {
                "avaliable": "false"
              }
            }
          }
        }
      ],
      #至少匹配多少
      "minimum_should_match": 2
    }
  }
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章