ElasticSearch(중국어 검색)source 요약

4098 단어 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"}
  }
}

좋은 웹페이지 즐겨찾기