ES字段类型以及部分字段设置

Field datatypes

string,long, integer, short, byte, double, float,date,boolean,binary,Array,object
nestedfor arrays of JSON objects
geo_pointfor lat/lon points
geo_shapefor complex shapes like polygons
ipfor IPv4 addresses
completionto provide auto-complete suggestions
token_countto count the number of tokens in a string
murmur3to compute hashes of values at index-time and store them in the index

See the mapper-attachments plugin which supports indexing attachments like Microsoft Office formats, Open Document formats, ePub, HTML, etc. into an attachment datatype.
https://www.elastic.co/guide/en/elasticsearch/plugins/2.4/mapper-attachments.html

index

option desp
no 该字段将不会被添加到索引中,该字段将不能被查询.
not_analyzed 将该字段的内容作为单个term添加到索引中,可以被作为单个trem进行搜索.(当字段设置为not_analyzed时,它会将其视为一个单一term, 底层Lucene索引中单个term的最大大小为32766字节,超出这个大小将报以下异常:message [java.lang.IllegalArgumentException: Document contains at least one immense term in field="***" (whose UTF8 encoding is longer than the max length 32766), all of which were skipped. Please correct the analyzer to not produce such terms.)
analyzed 此选项仅适用于字符串字段,因为它是默认字符串字段。 首先分析字符串字段值以将字符串转换为术语(例如,单个字的列表),然后索引。 在搜索时,查询字符串通过(通常)相同的分析器以生成与索引中相同格式的项。 正是这个过程启用全文搜索。

format

yyyy-MM-dd HH:mm:ss

store

默认情况下,字段值被编入索引以使其可搜索,但不会存储它们。 这意味着可以查询字段,但无法检索原始字段值。

通常这没关系。 字段值已经是_source字段的一部分,默认情况下存储它。 如果只想检索单个字段或几个字段的值,而不是整个_source,则可以使用源过滤来实现。

在某些情况下,存储字段可能有意义。 例如,如果您有一个包含标题,日期和非常大的内容字段的文档,您可能只需检索标题和日期,而无需从大型_source字段提取这些字段:

PUT /my_index
{
  "mappings": {
    "my_type": {
      "properties": {
        "title": {
          "type": "string",
          "store": true 
        },
        "date": {
          "type": "date",
          "store": true 
        },
        "content": {
          "type": "string"
        }
      }
    }
  }
}

PUT /my_index/my_type/1
{
  "title":   "Some short title",
  "date":    "2015-01-01",
  "content": "A very long content field..."
}

GET my_index/_search
{
  "fields": [ "title", "date" ] 
}

term_vector

option desp
no 不存储任何词向量 (default)
yes Just the terms in the field are stored.
with_positions Terms and positions are stored.
with_offsets Terms and character offsets are stored.
with_positions_offsets Terms, positions, and character offsets are stored.