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"
}
}
}