ElasticSearch(中国語検索)ソースの概要

これはかなりの話が含まれていませんが含まれています。 

GET /lib4/user/_search
{
  "query": {
    "match_all": {}
  },
  "_source": {
    "includes": ["name" ,"address"],
    "excludes": ["age" , "birthday" ]
  }
}

結果で直接見て

{
  "took" : 5,
  "timed_out" : false,
  "_shards" : {
    "total" : 3,
    "successful" : 3,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 5,
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "lib4",
        "_type" : "user",
        "_id" : "2",
        "_score" : 1.0,
        "_source" : {
          "address" : "北京海淀区清河",
          "name" : "赵明"
        }
      },
      {
        "_index" : "lib4",
        "_type" : "user",
        "_id" : "4",
        "_score" : 1.0,
        "_source" : {
          "address" : " 北京海淀区清河",
          "name" : "王五"
        }
      },
      {
        "_index" : "lib4",
        "_type" : "user",
        "_id" : "5",
        "_score" : 1.0,
        "_source" : {
          "address" : "北京海淀区清河",
          "name" : "张三"
        }
      },
      {
        "_index" : "lib4",
        "_type" : "user",
        "_id" : "1",
        "_score" : 1.0,
        "_source" : {
          "address" : "黑龙江省 铁岭",
          "name" : "赵六"
        }
      },
      {
        "_index" : "lib4",
        "_type" : "user",
        "_id" : "3",
        "_score" : 1.0,
        "_source" : {
          "address" : "北京海淀区清河",
          "name" : "lisi"
        }
      }
    ]
  }
}

 

GET /lib4/user/_search
{
  "_source": {
    "includes": "addr*" ,
    "excludes": ["name", "bir*"]
  },
  "query": {
    "match_all": {}
  }
}




#查询结果
{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 3,
    "successful" : 3,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 5,
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "lib4",
        "_type" : "user",
        "_id" : "2",
        "_score" : 1.0,
        "_source" : {
          "address" : "北京海淀区清河"
        }
      },
      {
        "_index" : "lib4",
        "_type" : "user",
        "_id" : "4",
        "_score" : 1.0,
        "_source" : {
          "address" : " 北京海淀区清河"
        }
      },
      {
        "_index" : "lib4",
        "_type" : "user",
        "_id" : "5",
        "_score" : 1.0,
        "_source" : {
          "address" : "北京海淀区清河"
        }
      },
      {
        "_index" : "lib4",
        "_type" : "user",
        "_id" : "1",
        "_score" : 1.0,
        "_source" : {
          "address" : "黑龙江省 铁岭"
        }
      },
      {
        "_index" : "lib4",
        "_type" : "user",
        "_id" : "3",
        "_score" : 1.0,
        "_source" : {
          "address" : "北京海淀区清河"
        }
      }
    ]
  }
}

ソートソート

GET /lib4/user/_search
{
  "query": {
    "match_all": {} 
  },
  "sort": {
     "age": {"order":"asc"}
  }
}

 

298元記事公開 ウォンの賞賛107 ビューに14万+を

おすすめ

転載: blog.csdn.net/ywl470812087/article/details/105008625