PUT mydata
{
"mappings": {
"_doc": {
"properties": {
"action": {
"type": "keyword"
},
"brand": {
"type": "keyword"
},
"city_id": {
"type": "long"
},
"date_end": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"date_start": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"device_id": {
"type": "long"
},
"duration": {
"type": "long"
},
"id": {
"type": "long"
},
"param": {
"type": "keyword"
},
"params": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"screen": {
"type": "long"
}
}
}
}
}
POST /mydata/_doc
{
"id": 14838494,
"action": "PLAY_CHANNEL",
"param": "3057",
"params": "Music Box TV",
"device_id": 11807,
"date_end": "2017-01-01 00:26:55",
"date_start": "2017-01-01 00:26:52",
"duration": 3527000,
"city_id": 2096,
"screen": 40,
"brand": "JVC"
}
GET mydata/_search
{ "size": 0,
"query": {
"bool": {
"should": [
{"range": {
"date_end": {
"gte": "2017-01-01 00:00:00",
"lte": "2017-01-02 00:00:00"
}
}},
{ "range": {
"date_start": {
"gte": "2017-01-01 00:00:00",
"lte": "2017-01-02 00:00:00"
}
}
}
],
"must": [
{"term": {
"action": {
"value": "PLAY_CHANNEL"
}
}}
]
}
},
"aggs": {
"brand_name": {
"terms": {
"field": "brand",
"size": 10
},
"aggs": {
"screen_size": {
"terms": {
"field": "screen",
"size": 10
},
"aggs": {
"stats": {
"stats": {
"field": "duration"
}
},
"devices": { "value_count": {
"field": "device_id"
}}
}
}
}
}
}
}
{
"took": 8,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 5,
"max_score": 0,
"hits": []
},
"aggregations": {
"brand_name": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "SONY",
"doc_count": 3,
"screen_size": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 50,
"doc_count": 2,
"devices": {
"value": 2
},
"stats": {
"count": 2,
"min": 3527000,
"max": 3527000,
"avg": 3527000,
"sum": 7054000
}
},
{
"key": 42,
"doc_count": 1,
"devices": {
"value": 1
},
"stats": {
"count": 1,
"min": 3527000,
"max": 3527000,
"avg": 3527000,
"sum": 3527000
}
}
]
}
},
{
"key": "JVC",
"doc_count": 2,
"screen_size": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 40,
"doc_count": 1,
"devices": {
"value": 1
},
"stats": {
"count": 1,
"min": 3527000,
"max": 3527000,
"avg": 3527000,
"sum": 3527000
}
},
{
"key": 42,
"doc_count": 1,
"devices": {
"value": 1
},
"stats": {
"count": 1,
"min": 3527000,
"max": 3527000,
"avg": 3527000,
"sum": 3527000
}
}
]
}
}
]
}
}
}
call2.add(call1.get(i));
отличается от моего call2.add(call1.remove(i));
???? Тем что я сразу удаляю и добавляю?! Или вместо цифирьки 0 переменную i не осилили поставить?!
Первый пример смотрите.