---
title: "ES学习"
author: "weifly"
date: "2017-10-31T10:34:12Z"
tags: []
categories: ["开源软件"]
slug: "es"
draft: false
lastmod: "2017-12-01T16:32:42Z"
id: 2398120
url: "https://weifly.iteye.com/blog/2398120"
---

查看类型（type）映射（mapping）：

```
GET /索引/_mapping/类型
```

 

value\_count聚合时，被聚合的字段不能是“\_id”。

 

date\_histogram聚合时，需要加时区：

```
{
    "aggs":{
        "by_day":{
            "date_histogram":{
                "field":"date",
                "interval":"day",
                "time_zone":"+08:00"
            }
        }
    }
}
```