Basic Type 1. String
String types are divided into two cases: Full-text and keywords.
Full-text indicates that the field content is parsed, and keywords indicates that the field value can only be queried as an exact value.
Parameters:
analyzer
,,,,,,,,,,,,,,,, boost
doc_values
fielddata
fields
ignore_above
include_in_all
index
index_options
norms
null_value
position_increment_gap
store
search_analyzer
search_quote_analyzer
similarity
term_vector
2. Values
Numeric types include: Long, Integer, short, Byte, double, float.
Parameters:
coerce
,,,,,,,, boost
doc_values
ignore_malformed
include_in_all
index
null_value
precision_step
store
3. Date
The JSON itself does not have a date data type, and the date type in ES can be:
- Similar to
"2015-01-01"
or"2015/01/01 12:10:30" 的字符串
long 类型的毫秒级别的时间戳
int 类型的秒级别的时间戳
日期类型默认会被转换为 UTC 并且转换为毫秒级别的时间戳的 long 类型存储。
日期类型如果不指定 format ,将会以默认格式表示。
参数:
boost
、doc_values
、format
、ignore_malformed
、include_in_all
、index
、null_value
、precision_step
、store
4. Boolean
Boolean false:,,,,, false
"false"
"off"
"no"
"0"
""
(empty string), 0
,0.0 。
布尔真: 任何不为假的值。
像 terms aggregation 聚合,是使用 1 和 0 来作为 key 的,key_as_string 则是用字符串 true 和 false
布尔类型的值,在 scripts 中则始终返回 1 或 0
参数:
boost
、doc_values
、index
、null_value
、store
5. Binary
Binary types receive a binary value in BASE64 encoding, and binary type fields are not stored by default and are not searchable.
Parameters: doc_values
,store
Complex Type 1. Array
Array type, which requires the data type of the array element to be identical.
- Array of strings: [
"one"
, "two"
]
- Array of numbers: [
1
, 2
]
- Array of arrays: [
1
, [ 2
,]] 3
which is the equivalent of [ 1
, 2
, 3
]
- Object array: [
{ "name": "Mary", "age": 12 }
, { "name": "John", "age": 10 }
] Note: Object elements in an object array cannot be queried
The data type of the array element will be determined by the data type of its first element.
An array of objects that will be converted to a multi-valued flat data type within ES.
For example:
PUT my_index/my_type/1{ "Group":"fans", "User" : [ { " First":"John", " Last":"Smith" }, { " First":"Alice", " Last":" White" } ]}
Switch to:
{ "Group":"fans", "User.first": ["Alice","John" ], "User.last": ["Smith"," White" ]}
2. Objects
The object type is internally indexed as a simple, flattened key-value pair type.
For example:
PUT my_index/my_type/1{ " Region":"US", "Manager": { " Age": -, "name": { " First":"John", " Last":"Smith" } }}
Convert to:
{ " Region":"US", "Manager.age": -, "Manager.name.first":"John", "Manager.name.last":"Smith"}
Parameters:
dynamic
, enabled
, include_in_all
,properties
3. Nesting
A nested type is a special type of object that allows each element (object) of an array of objects to be queried independently of each other.
A document of a nested type can:
- Querying with
nested
queries
- Used
nested
to analyze and reverse_nested
to aggregate
- Sort by nested sorting.
- Use nested inner hits to retrieve or highlight
Parameters:
dynamic
, include_in_all
,properties
Location Type 1. Coordinate type 2. Geographic shape type proprietary type 1. IPV4 type
The IPV4 data type is essentially a long type, but it can receive a IPV4 address and convert it to a long type store.
Parameters:
boost
,,,,, doc_values
include_in_all
index
null_value
precision_step
,store
2. Completion type (completion datatype) 3. Token Count 4. Mapper-murmur3
Fields (field) data type