# 3.2.1.1.核心数据类型

|      分类     | 字段的数据类型                                                               |
| :---------: | --------------------------------------------------------------------- |
| String 字符串型 | text和keyword                                                          |
| Numeric 数字型 | long, integer, short, byte, double, float, half\_float, scaled\_float |
|   Date 日期型  | date                                                                  |
| Boolean 布尔型 | boolean                                                               |
| Binary 二进制型 | binary                                                                |
|  Range 范围型  | integer\_range, float\_range, long\_range, double\_range, date\_range |

## String 字符串型

字符串型包括两种可用的数据类型：text和keyword

**区别详解：**

* text数据类型的字段会进行分词，能够全文索引，不能够用于排序（sort） 和聚合操作（aggregations)
* keyword数据类型不分词，够用于过滤、排序（sort） 和聚合操作（aggregations)

> 有时，同时具有全文（ `text` ）和关键字（ `keyword` ）版本是有帮助的：一个用于全文本搜索，另一个用于聚合和排序。这可以通过多字段实现。

**举例：**

字符串： `xiao xia mi`

text数据类型:会拆分成`xiao,xia,mi 三个单词进行倒排索引`

keyword数据类型：则会作为一个整体进行索引。

当进行搜索时候，term操作时（term对搜索的关键词不进行拆分，作为一个整体进行搜索），搜索“xiao xia mi“，则会作为整体进行搜索，只有keyword数据类型可以搜索的到，及时你搜索“”xiao“，仍然无法匹配，因为keyword数据类型把“xiao xia mi“作为一个整体进行索引。

* 如果说是**精确匹配（**&#x65;xact valu&#x65;**）**，则必须类型设置为keyword数据类型，搜索时使用term搜索，如如电子邮件地址（email addresses），主机名（hostnames），状态码（status codes），邮政编码（zip codes）和标签（tags）。
* 如果说是字段全文检索，则使用text数据类型，搜索时s会用match搜索（因为match搜索会进行分词，然后去搜索），如电子邮件内容，产品描述（product description）；

> 注意这边有一个历史遗留问题 原来代表字符串型的只有一个string的数据类型，现在拆分成了两个text和keyword
>
> 所以即使你使用string 做为mapping，不指定index属性（是否分词），则默认是text类型

详细解析：

**keyword数据类型：**

```
PUT /test_index
{
  "mappings": {
    "test_type": {
      "properties": {
         "full_name": {
           "type": "string",
           "index": "not_analyzed"
        }
      }
    }
  }
}
```

以上等价于5.x如下写法, 原因：not\_analyzed代表不分词,keyword数据类型代表不进行字段分词的数据类型

```
PUT /test_index
{
  "mappings": {
    "test_type": {
      "properties": {
         "full_name": {
           "type": "keyword"
        }
      }
    }
  }
}
```

**text数据类型**

```
PUT /test_index
{
  "mappings": {
    "test_type": {
      "properties": {
         "full_name": {
           "type": "string"
        }
      }
    }
  }
}
```

以上等价于5.x如下写法, 原因：默认为analyzed代表分词,text数据类型代表进行字段分词的数据类型

```
PUT /test_index
{
  "mappings": {
    "test_type": {
      "properties": {
         "full_name": {
           "type": "text"
        }
      }
    }
  }
}
```

发散思维：如果以下写法进行写

指定类型为text,是一个分词的数据类型，然后指定index属性为不分词，结果会是怎么样

```
PUT /test_index
{
  "mappings": {
    "test_type": {
      "properties": {
         "full_name": {
           "type": "text",
           "index": "not_analyzed"
        }
      }
    }
  }
}
```

结果查看,仍然为text数据类型：

```
GET /test_index/_mapping/test_type

{
  "test_index": {
    "mappings": {
      "test_type": {
        "properties": {
          "full_name": {
            "type": "text"
          }
        }
      }
    }
  }
}
```

### String**数据类型**

`string`字段不支持在5.x中创建的索引，这是因为`text`和`keyword`字段。在5.x中创建的索引中创建字符串字段将导致Elasticsearch尝试将`string`升级到相应的`text`或`keyword`字段。它将返回一个HTTP `Warning`请求头，告诉您该`string`已被弃用。此升级过程并不总是完美的，因为有一些string支持的组合功能，但不被`text`和`keyword支持` 。因此，最好使用`text`或`keyword` 。

从2.x导入的索引仅支持`string` ，而不支持`text`或`keyword` 。为了简化从2.x Elasticsearch的迁移，将应用于从2.x导入的索引的`text`和`keyword`映射降级为`string` 。最终，低于5.x版本的长期索引需要及时重建，截止时间为升级到6.x之前，这种降级可以在您分配合理后时间平滑进行。

### **text数据类型**

**示例：**

```
PUT my_index
{
  "mappings": {
    "my_type": {
      "properties": {
        "full_name": {
          "type":  "text"
        }
      }
    }
  }
}
```

**text数据类型字段的参数**

| `analyzer`                   | 分析器应用于analyzed字符串字段，无论是在索引时间还是在搜索时间（除非被search\_analyzer ）。 默认为默认索引分析器或standard分析器。                                     |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| boost                        | 映射字段级查询时间提升。 接受一个浮点数，默认为1.0 。                                                                                          |
| eager\_global\_ordinals      | 是否应该全新加载全局序号？ true或false （默认）。 对于经常用于（重要）术语聚合的字段，启用此功能是一个好主意。                                                          |
| fielddata                    | 是否可以使用内存中的字段数据进行排序，聚合或脚本编写？`true`或`false` （默认）                                                                         |
| fielddata\_frequency\_filter | 此为高级设置，允许在fielddata启用时决定哪些值加载到内存中。 默认情况下，所有值都被加载。                                                                      |
| fields                       | 多字段允许以多种方式将相同的字符串值索引到不同的目的，例如用于搜索的一个字段和用于排序和聚合的多字段，或由不同分析器分析的相同字符串值。                                                   |
| include\_in\_all             | 字段值是否应包含在\_all字段中？ 接受true或false 。如果index设置为no ，或者如果父object字段将include\_in\_all，默认设置为false。 否则默认为true 。                  |
| index                        | 字段是否参数搜索，参数只接受 true (默认值) 和 false                                                                                      |
| index\_options               | 索引中应存储哪些信息，以便搜索和突出显示。 默认为positions 。                                                                                   |
| norms                        | 在评分查询时是否应考虑字段长度。 接受true （默认）或false 。                                                                                   |
| position\_increment\_gap     | 应该在字符串数组的每个元素之间插入的假项目位置的数量。 默认为在分析器上配置的position\_increment\_gap ，默认为100 。 100被选中，因为它阻止了匹配术语与字段值之间的合理大小的间隔（小于100）的短语查询。 |
| store                        | 字段值是否应与\_source字段分开存储和检索。 接受true或false （默认）。                                                                           |
| search\_analyzer             | analyzer应在搜索时使用在analyzed领域。 默认为analyzer设置。                                                                             |
| search\_quote\_analyzer      | 在遇到短语时应在搜索时使用的分析器。 默认为search\_analyzer设置。                                                                              |
| similarity                   | 应该使用哪种评分算法或相似度 。 默认为BM25                                                                                               |
| term\_vector                 | 是否应为analyzed字段存储术语向量。 默认为no 。                                                                                          |

> 从5.x向2.x导入的索引不支持`text类型`。需要将将`text类型转`为`string类型` ，采用重建方式。

### keyword数据类型

**示例：**

```
PUT my_index
{
  "mappings": {
    "my_type": {
      "properties": {
        "tags": {
          "type":  "keyword"
        }
      }
    }
  }
}
```

**keyword数据类型字段的参数**

| boost                   | 映射字段级查询时间提升。 接受一个浮点数，默认为1.0 。                                                                         |
| ----------------------- | ----------------------------------------------------------------------------------------------------- |
| doc\_values             | 该字段是否应该以多列的方式存储在磁盘上，以便以后可以将其用于排序，聚合或脚本？ 接受true（默认）或false。                                             |
| eager\_global\_ordinals | 是否应该全新加载全局序号？ true或false （默认）。 对于经常用于（重要）术语聚合的字段，启用此功能是一个好主意。                                         |
| fields                  | 多字段允许以多种方式将相同的字符串值索引到不同的目的，例如用于搜索的一个字段和用于排序和聚合的多字段，或由不同分析器分析的相同字符串值。                                  |
| ignore\_above           |                                                                                                       |
| include\_in\_all        | 字段值是否应包含在\_all字段中？ 接受true或false 。如果index设置为no ，或者如果父object字段将include\_in\_all，默认设置为false。 否则默认为true 。 |
| index                   | 字段是否参数搜索，参数只接受 true (默认值) 和 false                                                                     |
| index\_options          | 索引中应存储哪些信息，以便搜索和突出显示。 默认为positions 。                                                                  |
| norms                   | 在评分查询时是否应考虑字段长度。 接受true （默认）或false 。                                                                  |
| null\_value             | 接受一个字符串作为替换任何显式空值的字段。 默认为null，这意味着该字段被视为丢失。                                                           |
| store                   | 字段值是否应与\_source字段分开存储和检索。 接受true或false （默认）。                                                          |
| search\_analyzer        | analyzer应在搜索时使用在analyzed领域。 默认为analyzer设置。                                                            |
| search\_quote\_analyzer | 在遇到短语时应在搜索时使用的分析器。 默认为search\_analyzer设置。                                                             |
| similarity              | 应该使用哪种评分算法或相似度 。 默认为BM25                                                                              |

> 从5.x向2.x导入的索引不支持`text类型`。需要将将`text类型转`为`string类型` ，采用重建方式。

## Numeric 数字型

下面的数字型所支持的数据类型：

| long          | 一个有符号的64位整数，最小值是 $$-2^{63}$$ 并且最大值是$$2^{63} -1$$     |
| ------------- | ---------------------------------------------------- |
| integer       | 一个有符号的32位整数，最小值是$$$$ $$-2^{31}$$ 并且最大值是$$2^{31} -1$$ |
| short         | 一个有符号的16位整数,最小值是-32,768 并且最大值是32,767                 |
| byte          | 一个有符号的８位整数,最小值是-128 并且最大值是127                        |
| double        | 双精度64位IEEE 754浮点。                                    |
| float         | 32位单精度IEEE 754浮点。                                    |
| half\_float   | 16位IEEE 754浮点。                                       |
| scaled\_float | 支持long数据类型和一个固定的比例因子                                 |

下面是配置一个数字字段映射的一个例子

```
PUT my_index
{
  "mappings": {
    "my_type": {
      "properties": {
        "number_of_bytes": {
          "type": "integer"
        },
        "time_in_seconds": {
          "type": "float"
        },
        "price": {
          "type": "scaled_float",
          "scaling_factor": 100
        }
      }
    }
  }
}
```

> 注意：double , float 和half\_float数据类型的-0.0 和 +0.0是不同值。因此,做一个term查询-0.0将不匹配 +0.0,反之亦然。同样适用于范围(range)查询:如果上限是 -0.0．那么 +0.0就会不匹配,如果下界+0.0．那么 -0.0将不匹配

#### 类型如何选择？

在满足需求的情况下，尽可能选择范围小的数据类型。比如，某个字段的取值最大值不会超过100，那么选择byte类型即可。迄今为止吉尼斯记录的人类的年龄的最大值为134岁，对于年龄字段，short足矣。字段的长度越短，索引和搜索的效率越高。 优先考虑使用带缩放因子的浮点类型。

## Date 日期型

JSON没有date这种数据类型, 所以elasticsearch中的date可以是以下形式:

* 包含格式化日期的字符串，例如 “2015-01-01”或“2015/01/01 12:10:30”。
* 代表milliseconds-since-the-epoch的长整型数。
* 代表seconds-since-the-epoch的整型数。

在内部，日期将转换为UTC（如果指定了时区），并将其存储为表示milliseconds-since-the-epoch的长整型数。

日期格式可以自定义，但如果没有指定格式，则使用默认格式：

```
"strict_date_optional_time||epoch_millis"
```

这意味着它将接受带有可选时间戳的日期，这些日期符合strict\_date\_optional\_time或者milliseconds-since-the-epoch所支持的格式。

例如：

```
PUT my_index
{
  "mappings": {
    "my_type": {
      "properties": {
        "date": {
          "type": "date" #1
        }
      }
    }
  }
}

PUT my_index/my_type/1
{ "date": "2015-01-01" } #2

PUT my_index/my_type/2
{ "date": "2015-01-01T12:10:30Z" } #3

PUT my_index/my_type/3
{ "date": 1420070400001 } #4

GET my_index/_search
{
  "sort": { "date": "asc"} #5
}
```

| 1 | 日期属性使用的默认格式。                       |
| - | ---------------------------------- |
| 2 | 本文档使用纯文本。                          |
| 3 | 本文档包含了一段时间。                        |
| 4 | 本文档使用milliseconds-since-the-epoch. |
| 5 | 请注意，返回的排序值全部以毫秒为单位。                |

### 多日期格式 <a href="#date-duo-ri-qi-ge-shi" id="date-duo-ri-qi-ge-shi"></a>

可以使用||分隔多个格式 作为分隔符。 将依次尝试每种格式，直到找到匹配的格式。 第一个格式将用于将从时间的毫秒转换为字符串。

```
PUT my_index
{
  "mappings": {
    "my_type": {
      "properties": {
        "date": {
          "type":   "date",
          "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
        }
      } 
    }
  }
}
```

### date字段的参数 <a href="#datedate-zi-duan-de-can-shu" id="datedate-zi-duan-de-can-shu"></a>

**date**字段接受以下参数：

| [`boost`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/mapping-boost.html)               | 映射字段级查询时间提升。 接受一个浮点数，默认为**1.0**。                                                                                                     |
| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| [`doc_values`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/doc-values.html)             | 该字段是否应该以多列的方式存储在磁盘上，以便以后可以将其用于排序，聚合或脚本？ 接受**true**（默认）或**false**。                                                                    |
| [`format`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/mapping-date-format.html)        | 可以解析的日期格式。默认是`strict_date_optional_time`丨丨`epoch_millis。`                                                                            |
| `locale`                                                                                                | 从几个月来解析日期时使用的区域设置在所有语言中都不具有相同的名称和/或缩写。 默认为 [`ROOT` locale](https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html#ROOT),    |
| [`ignore_malformed`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/ignore-malformed.html) | 如果为真，则格式错误的数字将被忽略。 如果为**false**（默认），格式错误的数字会引发异常并拒绝整个文档。                                                                             |
| [`include_in_all`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/include-in-all.html)     | 字段值是否应包含&#x5728;**\_all**字段中？ 接受真或假 如果**index**设置为**false**，或者如果父对象字段将**include\_in\_all**设置为**false**，则默认为**false**。 否则默认为**true**。 |
| [`index`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/mapping-index.html)               | 应该可以搜索该字段吗？ 接受**true**（默认）和**false**。                                                                                                |
| [`null_value`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/null-value.html)             | 接受一个配置格式的日期值作为替换任何显式空值的字段。 默认为**null**，这意味着该字段被视为丢失。                                                                                 |
| [`store`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/mapping-store.html)               | 字段值是否应&#x4E0E;**\_source**字段分开存储和检索。 接受**true**或**false**（默认）。                                                                       |

## Boolean 布尔型

布尔字段接受JSON**true**和**false**值，但也可以接受被解释为**true**或**false**的字符串和数字：

| False值 | `false`, `"false"`, `"off"`, `"no"`, `"0"`, `""`, `0`, `0.0` |
| ------ | ------------------------------------------------------------ |
| True值  | 任何非false值                                                    |

> 一定要规范只使用 true 和 false
>
> **5.1.0中弃用。**
>
> 虽然Elasticsearch目前在索引时间内接受上述值。 不建议使用这些伪布尔值搜索布尔域。 请改用“**true**”或“**false**”。
>
> **在5.3.0中弃用**
>
> 任何非false，“false”，true和“true”的值已被弃用。

例如：

```
PUT my_index
{
  "mappings": {
    "my_type": {
      "properties": {
        "is_published": {
          "type": "boolean"
        }
      }
    }
  }
}

POST my_index/my_type/1
{
  "is_published": "true" #1
}

GET my_index/_search
{
  "query": {
    "term": {
      "is_published": true #2
    }
  }
}
```

| 1 | 索引了一个文档`"true"`, 被解析成了`true`. |
| - | ----------------------------- |
| 2 | 使用`true搜索文档`                  |

```
POST my_index/my_type/1
{
  "is_published": true
}

POST my_index/my_type/2
{
  "is_published": false
}

GET my_index/_search
{
  "aggs": {
    "publish_state": {
      "terms": {
        "field": "is_published"
      }
    }
  },
  "script_fields": {
    "is_published": {
      "script": {
        "lang": "painless",
        "inline": "doc['is_published'].value"
      }
    }
  }
}
```

### Boolean字段的参数 <a href="#booleanboolean-zi-duan-de-can-shu" id="booleanboolean-zi-duan-de-can-shu"></a>

**boolean**字段接受以下参数

| [`boost`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/mapping-boost.html)   | 映射字段级查询时间提升。 接受一个浮点数，默认为**1.0**。                                  |
| ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| [`doc_values`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/doc-values.html) | 该字段是否应该以多列的方式存储在磁盘上，以便以后可以将其用于排序，聚合或脚本？ 接受**true**（默认）或**false**。 |
| [`index`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/mapping-index.html)   | 应该可以搜索该字段吗？**接受true（默认）和false。**                                  |
| [`null_value`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/null-value.html) | 接受上面列出的任何真实或虚假的价值。 该值替换任何显式空值。 默认为**null**，这意味着该字段被视为丢失。          |
| [`store`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/mapping-store.html)   | 字段值是否应&#x4E0E;**\_sourcefield**分开存储和检索。 接受**true**或**false**（默认）。 |

## Binary 二进制型

**binary**（二进制）类型接受二进制值作为**Base64**编码字符串。 该字段默认情况下不存储，不可搜索：

```
PUT my_index
{
  "mappings": {
    "my_type": {
      "properties": {
        "name": {
          "type": "text"
        },
        "blob": {
          "type": "binary"
        }
      }
    }
  }
}

PUT my_index/my_type/1
{
  "name": "Some binary blob",
  "blob": "U29tZSBiaW5hcnkgYmxvYg=="  #1
}
```

| 1 | **Base64**编码的二进制值不能有嵌入的换行&#x7B26;**\n**。 |
| - | ---------------------------------------- |

### binary字段的参数 <a href="#binarybinary-zi-duan-de-can-shu" id="binarybinary-zi-duan-de-can-shu"></a>

**binary**（二进制）字段接受一下参数

| [`doc_values`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/doc-values.html) | 该字段是否应该以多列的方式存储在磁盘上，以便以后可以将其用于排序，聚合或脚本？ 接受true（默认）或false。 |
| ------------------------------------------------------------------------------------------- | --------------------------------------------------------- |
| [`store`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/mapping-store.html)   | 字段值是否应与\_sourcefield分开存储和检索。 接受**true**或**false**（默认）。    |

> 白话解析:
>
> 二进制字段是存储在索引中的二进制数据的Base64表示,可用来存储以二进制形式正常写入的数据,例如图像.基于此类型的字段在默认情况下制备存储,而不索引,因此只能提取,但无法对其执行搜索操作.

## Range 范围型

支持以下范围类型：

| `integer_range` | 32位有符号整型数范围。最小值是$$-2^{31}$$，最大值是$$2^{31}-1$$`。` |
| --------------- | ----------------------------------------------- |
| `float_range`   | 单精度32位IEEE 754浮点值范围。                            |
| `long_range`    | 64位有符号整型数范围。最小值是$$-2^{63}$$，最大值是$$2^{63}-1$$`。` |
| `double_range`  | 双精度64位IEEE 754浮点值范围。                            |
| `date_range`    | 以系统纪元经过的无符号64位整数毫秒表示的日期值范围。                     |

以下是使用各种范围字段配置映射的示例，后跟跟踪多个范围类型的示例。

```
PUT range_index
{
  "mappings": {
    "my_type": {
      "properties": {
        "expected_attendees": {
          "type": "integer_range"
        },
        "time_frame": {
          "type": "date_range", #1
          "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
        }
      }
    }
  }
}

PUT range_index/my_type/1
{
  "expected_attendees" : { #2
    "gte" : 10,
    "lte" : 20
  },
  "time_frame" : { #3
    "gte" : "2015-10-31 12:00:00", #4
    "lte" : "2015-11-01"
  }
}
```

以下是date\_range查询的一个例子，该日期字段名为“time\_frame”。

```
POST range_index/_search
{
  "query" : {
    "range" : {
      "time_frame" : { #5
        "gte" : "2015-10-31",
        "lte" : "2015-11-01",
        "relation" : "within" #6
      }
    }
  }
}
```

上述查询产生的结果。

```
{
  "took": 13,
  "timed_out": false,
  "_shards" : {
    "total": 2,
    "successful": 2,
    "failed": 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "range_index",
        "_type" : "my_type",
        "_id" : "1",
        "_score" : 1.0,
        "_source" : {
          "expected_attendees" : {
            "gte" : 10, "lte" : 20
          },
          "time_frame" : {
            "gte" : "2015-10-31 12:00:00", "lte" : "2015-11-01"
          }
        }
      }
    ]
  }
}
```

| 1 | **date\_range**类型接受由日期类型定义的相同字段参数。                                |
| - | ----------------------------------------------------------------- |
| 2 | 举办与10至20名与会者的会议举例。                                                |
| 3 | 日期范围接受与**date range queries**（日期范围查询）中所述相同的格式。                    |
| 4 | 示例日期范围使用日期时间戳。 这也接受日期数学格式，或者系统时间的“**now**”。                       |
| 5 | **Range queries**（范围查询）与**range query**（范围查询）中所述相同。               |
| 6 | 范围查询范围字段支持一个关系参数，可以是**WITHIN**，**CONTAINS**，**INTERSECTS**（默认）之一。 |

### range字段的参数 <a href="#rangerange-zi-duan-de-can-shu" id="rangerange-zi-duan-de-can-shu"></a>

**range**字段接受一下参数：

| [`coerce`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/coerce.html)                 | 尝试将字符串转换为数字并截断整数的分数。 接受**true**（默认）和**false**。                                                                                                        |
| --------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`boost`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/mapping-boost.html)           | 映射字段级查询时间提升。 接受一个浮点数，默认为**1.0**。                                                                                                                      |
| [`include_in_all`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/include-in-all.html) | 字段值是否应包含&#x5728;**\_all**字段中？ 接受**true**或者**false**。 如果**index**设置为**false**，或者如果父对象字段将**include\_in\_all**设置为**false**，则默认为**false**。 否则默认为**true**。 |
| [`index`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/mapping-index.html)           | 应该可以搜索该字段吗？ 接受**true**（默认）和**false**。                                                                                                                 |
| [`store`](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/mapping-store.html)           | 字段值是否应&#x4E0E;**\_source**字段分开存储和检索。 接受**true**或**false**（默认）。                                                                                        |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xiaoxiami.gitbook.io/elasticsearch/ji-chu/mapping/zi-duan-de-shu-ju-lei-xing/3211he-xin-shu-ju-lei-xing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
