1、text
This field is used to index full-text text, such as the body of an email or the description of a product. These fields are analyzed, i.e., a list of individual terms before being converted into an index by the analyzer. The analysis process allows Elasticsearch to search for individual words in each full-text field. Text fields are not used for sorting and are rarely used for aggregation (although the important term aggregation is a notable exception). If you need to index structured content like email addresses, hostnames, status codes, or labels, you should probably use keyword fields. For codes or tags, you should also use the keyword field.
Sometimes it's helpful to have both full-text and keyword versions: one for full-text searches and the other for aggregation and sorting. This can be achieved through multifielding.
2、keyword
Fields used to index structured data, such as email addresses, hostnames, status codes, zip codes, or labels, are often used to filter (find all blog posts with a status of published), sort, and aggregate. Keyword fields can only be searched by exact values. If you need to index full-text content, such as email or product descriptions, then you may want to use the text field.
3. Number type
integer、float
4、array
In Elasticsearch, there is no specific array type. By default, any field can contain 0 or more values, however, all values in arrays must have the same data type, for example: String array: ["one", "two"] Integer arrays: [1,2] array of arrays: [1, [2, 3]], equivalent to [1,2,3] Object array: [ { "name": "Mary", "age": 12 }, { "name": "John", "age": 10 }]
When a field is automatically added, the first value of the array determines the type of field. All subsequent values must use the same data type, or at least be able to convert them to the same type as it Arrays don't support mixed data types: [10, "some string"] Arrays can contain null values that can be replaced by the configured null_value or skipped entirely. An empty array[] is treated as a non-existent field - a field with no value.
Using the array type in documentation does not require any configuration in advance, it is natively supported.
5、boolean
Boolean fields accept JSON true and false values, but can also accept strings and numbers that are interpreted as true or false
Deprecated in 5.3.0.
Any non-false, "false", true, and "true" values have been deprecated. You cannot use these pseudo-boolean values ("off", "no", "0", "", 0, 0, 0.0) to search for boolean domains. Please use true or false instead.
6、date
Internally, the date is converted to UTC (if the time zone is specified) and stored as a long integer representing milliseconds-since-the-epoch. The date format can be customized, but if no format is specified, the default format is used:
"strict_date_optional_time|| epoch_millis"
Meaning it will accept dates with optional timestamps that match strict_date_optional_time or
milliseconds-since-the-epoch.
Reference links:https://www.elastic.co/guide/en/ ... ml#strict-date-time
7、binary
The binary type accepts binary values as Base64-encoded strings. This field is not stored by default and is not searchable
|