es索引的相关操作

GET /ceshi/_search
{
  "query": {
    "match_all": {}
  },
  "size": 10
  
}


GET data

DELETE /data


GET /data/_search
{
  "track_total_hits": true, 
"query": {
  "range": {
    "pubdate": {
      "lte": "2023-04-24",
      "gte": "2023-04-23"
    }
  }
}
}

GET /data/_search
{
  "track_total_hits": true

}

GET /data/_search
{
  "query": {
     "terms": {
     "dataSourceCount": [
       "微博",
       "抖音",
       "微信",
       "新闻",
       "论坛",
       "App"
     ]
   }
  }, 
  "size": 0, 
  "aggs": {
    "dataSourceAgg": {
      "terms": {
        "field": "dataSourceCount",
        "order": {
          "_count": "desc" 
        },
        "size": 20
      }
    }
  }
}


GET /data/_search
{
 "query": {
   "terms": {
     "dataSourceCount": [
       "微博",
       "抖音"
     ]
   }
 },
 "collapse": {
   "field": "dataSourceCount"
 }
}

POST /data/_delete_by_query
{
  "query":{
    "range":{
      "pubdate":{
       "lt": "now-7d",
       "format": "epoch_millis"
      }
    }
  }
}

PUT /data
{
  "mappings": {
    "properties": {
      "title":{
        "type": "text",
        "analyzer": "ik_max_word"
      },
      "pubdate":{
        "type": "date",
        "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
      },
      "content":{
        "type": "text",
        "analyzer": "ik_max_word"
     },
     "author":{
       "type": "text",
        "analyzer": "ik_max_word"
     },
     "dataSource":{
       "type": "text",
       "analyzer": "ik_max_word",
       "copy_to": "dataSourceCount"
     },
     "dataSourceCount":{
       "type": "keyword"
     },
     "domain":{
       "type": "keyword"
     },
     "mediaUserId":{
       "type": "keyword"
     },
     "isorigin":{
       "type": "keyword"
     },
     "sourceName":{
       "type": "keyword"
     },
     "repeatcount":{
       "type": "integer"
     },
     "commtcount":{
       "type": "integer"
     },
     "agreecount":{
       "type": "integer"
     },
     "readcount":{
       "type": "integer"
     },
     "videoUrl":{
       "type": "keyword"
     },
     "formats":{
       "type": "keyword"
     },
     "imgUrl":{
       "type": "keyword"
     }
    }
  }
}

GET data

PUT ceshi


GET /data/_search
{
  "_source": ["dataSource","domain"],
 "collapse": {
   "field": "domain"
 },
 "size":10000,
 "from": 10000
}

PUT _all/_settings
{
  "index.blocks.read_only_allow_delete": null
}
DELETE /data/_doc/WX-ErIcBM4A3ZKY491bD

PUT ceshi

PUT /data/_settings
{
  "index":
  {"max_result_window":100000}
}

POST data/_delete_by_query
{
  
  "query":{
    "range": {
    "pubdate": {
      "lt": "now-7d",
      "format":"epoch_millis"
      }
    }
  }
}
 

查询重复数据

GET data/_search
{
    "size":0,
    "aggs":{
        "field":{
            "terms":{
                "field":"id.keyword",
                "size":100,
                "order": {
                  "_count": "desc"
                }
            }
        }
    }
}
 

添加字段

PUT data/_mapping
{
    "properties":{
       "userId":{
         "type" : "keyword"
       }
    }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值