To be able to process date fields into dates, manipulate numeric fields into numbers, process string fields into full text (Full-text) or exact string values, Elasticsearch need to know what type is contained within each field. The information for these types and fields is stored (contained) in the mapping (mapping).
Elasticsearch supports the following simple field types:
| type |
| String |
string |
| Whole number |
byte, short, integer, long |
| Floating point |
float , double |
| Boolean |
boolean |
| Date |
date
|
View the mapping of an index
{"Site_test": { "mappings": { "Test": { "Properties": { "@timestamp": { "type": "Date", "format": "strict_date_optional_time| | Epoch_millis " }, "Count": { "type": "Long" }, "Brower": { "type": "String" } } } } }}
Original address: http://irow10.blog.51cto.com/2425361/1851001
In the above mapping we can see that there are three variables in this index, namely date type, long type and string type
We can also view mapping in other ways. View index information of index with head plugin
Where the string type of the field, the default, considering the inclusion of full text, their values before the index to undergo parser analysis, and before the full-text search for this field to do analysis of the query statement. This means that fields defined as String are split by default by a rule. such as: HELLO100 will be split into Hello 1002 fields. Chinese characters will be split into a few. It's embarrassing to paint!
Is the data that the head plugin in Elasticsearch is querying
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/87/09/wKioL1fSJSLBGdX6AAAnb89QWw0822.png "title=" 2.png " alt= "Wkiol1fsjslbgdx6aaanb89qww0822.png"/>
The Windows 8.1 field is the mapping corresponding to the brower above. The type is string.
We look at the information for each field in the Kibana setting site_test
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/87/0B/wKiom1fSJaqCXB2tAAApI6lelzM567.png "title=" 1.png " alt= "Wkiom1fsjaqcxb2taaapi6lelzm567.png"/>String type brower in analyzed (analysis) This option is ticked!
Now let's try to see if there's anything unusual with Kibana drawing.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/87/0B/wKiom1fSJjzS1y7TAAAhbIwKbdc335.png "title=" 3.png " alt= "Wkiom1fsjjzs1y7taaahbiwkbdc335.png"/> how Windows and 8.1 are divided into two fields to draw, this is not the result we want. So how do we fix it?
Custom mapping
You must create a new index because the mapping of an index is changed again.
[[email protected] es]# curl-xpost http://192.168.10.49:9200/site_test{"acknowledged": true}
Put the new mapping into a file class: mapping
{ "Test": { "Properties": { "@timestamp": { "type": "Date", "format": "strict_date_optional_time| | Epoch_millis "                } , "Count": { "type": "Long" }, "Brower": { "type": "String", "index": "not_analyzed" } } } }
Add an extra attribute to the Brower field not_analyzed (no participle)!
[[email protected] es]# curl-xpost "Http://192.168.10.49:9200/site_test/test/_mapping?pretty"-d ' @mapping ' {" Acknowledged ": true}
So the index and the mapping are defined and then import the data will not appear participle!
Note: If you have multiple _type, define one, and the others will expand your mapping in a well-defined format.
Of course, we can also take the above two steps to achieve a step in place. As follows:
Curl-xput ' http://192.168.10.49:9200/site_test '-d ' @mapping '
The above command can be done to build indexes and mapping.
This article is from the "Tranquility Zhiyuan" blog, please be sure to keep this source http://irow10.blog.51cto.com/2425361/1851001
Introduction of the mapping of Elasticsearc