반응형
Recent Posts
Recent Comments
관리 메뉴

개발잡부

Aggs cardinality 본문

ElasticStack/Elasticsearch

Aggs cardinality

닉의네임 2023. 11. 13. 09:15
반응형

 

 

 

 

 

GET home-search-query-log/_search
{
  "size": 1,
  "query": {
    "bool": {
      "filter": [
        {
          "range": {
            "query_log.created_date_time": {
              "gte": "2023-10-29T22:40:00",
              "lt": "2023-10-29T22:45:00"
            }
          }
        },
        {
          "term": {
                   "query_log.result_count": 0
          }
        }
      ]
    }
  },
  "aggs": {
    "cardinality": {
      "cardinality": {
        "field": "query_log.input_query.keyword"
      }
    }
  }, 
    
  "track_total_hits": true
}

 

 

{
  "took" : 18,
  "timed_out" : false,
  "_shards" : {
    "total" : 88,
    "successful" : 88,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 232,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  },
  "aggregations" : {
    "cardinality" : {
      "value" : 173
    }
  }
}
반응형
Comments