zoukankan      html  css  js  c++  java
  • Elasticsearch按请求体基本查询

    1 分页:

    localhost:9200/get-together/_search   

    {
    "query": {
    "match_all": {}
    },
    "from": 10,
    "size": 10
    }

    2 查询具体字段:

    localhost:9200/get-together/_search

    {
    "query": {
    "match_all": {}
    },
    "_source": ["name", "date"]
    }

    在指定字段时,你甚至可以使用通配符,比如你要查询name和nation,只要写na*就行了;你也可以指定你不想要返回的字段 "exclude": ["location.geolocation"],想要返回的字段:"include": ["location.*", "date"]。

    3 排序:

     如果没有指定任何排序的信息,es默认按照_score降序排序,score其实就是每个文档与你查询的匹配度。

    自定义排序 :localhost:9200/get-together/_search

    {
    "query": {
    "match_all": {}
    },
    "sort": [
    {"created_on": "asc"},
    {"name": "desc"},
    "_score"
    ]
    }

    4 同时运用以上三个的完整查询:localhost:9200/get-together/group/_search

    {
    "query": {
    "match_all": {}
    },
    "from": 0,
    "size": 10,
    "_source": ["name", "organizer", "description"],
    "sort": [{"created_on": "desc"}]
    }

  • 相关阅读:
    iOS13 present VC方法
    青囊奥语
    三元九运的排盘
    三元九运 笔记
    青囊经
    金钱卦起卦
    易经中九二六三是什么意思
    用神
    六爻预测中的世爻,应爻分别代表什么
    div2-1519-D-Maximum Sum of Products-dp
  • 原文地址:https://www.cnblogs.com/minjay/p/6724086.html
Copyright © 2011-2022 走看看