[DOCS] Simplify index template snippets for data streams (#59533) (#59553)

Removes the `@timestamp` field mapping from several data stream index
template snippets.

With #59317, the `@timestamp` field defaults to a `date` field data type
for data streams.
This commit is contained in:
James Rodewig 2020-07-14 17:28:43 -04:00 committed by GitHub
parent be4483034c
commit e5baacbe2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 15 additions and 123 deletions

View File

@ -52,31 +52,13 @@ PUT /_ilm/policy/logs_policy
PUT /_index_template/logs_data_stream PUT /_index_template/logs_data_stream
{ {
"index_patterns": [ "logs*" ], "index_patterns": [ "logs*" ],
"data_stream": {}, "data_stream": { }
"template": {
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
}
}
}
}
} }
PUT /_index_template/new_logs_data_stream PUT /_index_template/new_logs_data_stream
{ {
"index_patterns": [ "new_logs*" ], "index_patterns": [ "new_logs*" ],
"data_stream": {}, "data_stream": { }
"template": {
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
}
}
}
}
} }
PUT /_data_stream/logs PUT /_data_stream/logs
@ -120,13 +102,10 @@ for a new field, `message`, to the template.
PUT /_index_template/logs_data_stream PUT /_index_template/logs_data_stream
{ {
"index_patterns": [ "logs*" ], "index_patterns": [ "logs*" ],
"data_stream": {}, "data_stream": { },
"template": { "template": {
"mappings": { "mappings": {
"properties": { "properties": {
"@timestamp": {
"type": "date"
},
"message": { <1> "message": { <1>
"type": "text" "type": "text"
} }
@ -187,13 +166,10 @@ mapping parameter to `true`.
PUT /_index_template/logs_data_stream PUT /_index_template/logs_data_stream
{ {
"index_patterns": [ "logs*" ], "index_patterns": [ "logs*" ],
"data_stream": {}, "data_stream": { },
"template": { "template": {
"mappings": { "mappings": {
"properties": { "properties": {
"@timestamp": {
"type": "date"
},
"host": { "host": {
"properties": { "properties": {
"ip": { "ip": {
@ -271,15 +247,8 @@ template's `index.refresh_interval` index setting to `30s` (30 seconds).
PUT /_index_template/logs_data_stream PUT /_index_template/logs_data_stream
{ {
"index_patterns": [ "logs*" ], "index_patterns": [ "logs*" ],
"data_stream": {}, "data_stream": { },
"template": { "template": {
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
}
}
},
"settings": { "settings": {
"index.refresh_interval": "30s" <1> "index.refresh_interval": "30s" <1>
} }
@ -335,15 +304,8 @@ The following <<indices-templates,put index template API>> requests adds new
PUT /_index_template/logs_data_stream PUT /_index_template/logs_data_stream
{ {
"index_patterns": [ "logs*" ], "index_patterns": [ "logs*" ],
"data_stream": {}, "data_stream": { },
"template": { "template": {
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
}
}
},
"settings": { "settings": {
"sort.field": [ "@timestamp"], <1> "sort.field": [ "@timestamp"], <1>
"sort.order": [ "desc"] <2> "sort.order": [ "desc"] <2>
@ -448,7 +410,7 @@ uses the `logs_data_stream` template as its basis, with the following changes:
PUT /_index_template/new_logs_data_stream PUT /_index_template/new_logs_data_stream
{ {
"index_patterns": [ "new_logs*" ], "index_patterns": [ "new_logs*" ],
"data_stream": {}, "data_stream": { },
"template": { "template": {
"mappings": { "mappings": {
"properties": { "properties": {

View File

@ -177,7 +177,7 @@ field data type by default.
PUT /_index_template/logs_data_stream PUT /_index_template/logs_data_stream
{ {
"index_patterns": [ "logs*" ], "index_patterns": [ "logs*" ],
"data_stream": {}, "data_stream": { },
"template": { "template": {
"settings": { "settings": {
"index.lifecycle.name": "logs_policy" "index.lifecycle.name": "logs_policy"

View File

@ -19,16 +19,7 @@ the following:
PUT /_index_template/logs_data_stream PUT /_index_template/logs_data_stream
{ {
"index_patterns": [ "logs*" ], "index_patterns": [ "logs*" ],
"data_stream": {}, "data_stream": { }
"template": {
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
}
}
}
}
} }
PUT /_data_stream/logs PUT /_data_stream/logs

View File

@ -121,19 +121,12 @@ with the options you specify.
PUT _index_template/timeseries_template PUT _index_template/timeseries_template
{ {
"index_patterns": ["timeseries"], <1> "index_patterns": ["timeseries"], <1>
"data_stream": {}, "data_stream": { },
"template": { "template": {
"settings": { "settings": {
"number_of_shards": 1, "number_of_shards": 1,
"number_of_replicas": 1, "number_of_replicas": 1,
"index.lifecycle.name": "timeseries_policy" <2> "index.lifecycle.name": "timeseries_policy" <2>
},
"mappings": {
"properties": {
"@timestamp": {
"type": "date" <3>
}
}
} }
} }
} }
@ -142,8 +135,6 @@ PUT _index_template/timeseries_template
<1> Apply the template when a document is indexed into the `timeseries` target. <1> Apply the template when a document is indexed into the `timeseries` target.
<2> The name of the {ilm-init} policy used to manage the data stream. <2> The name of the {ilm-init} policy used to manage the data stream.
<3> A <<date,`date`>> or <<date_nanos,`date_nanos`>> field mapping for the
"@timestamp" field the data stream will use.
==== ====
[discrete] [discrete]

View File

@ -16,16 +16,7 @@ See <<set-up-a-data-stream>>.
PUT /_index_template/template PUT /_index_template/template
{ {
"index_patterns": ["my-data-stream*"], "index_patterns": ["my-data-stream*"],
"template": { "data_stream": { }
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
}
}
}
},
"data_stream": {}
} }
---- ----
//// ////

View File

@ -14,16 +14,7 @@ indices. See <<delete-a-data-stream>>.
PUT /_index_template/template PUT /_index_template/template
{ {
"index_patterns": ["my-data-stream*"], "index_patterns": ["my-data-stream*"],
"template": { "data_stream": { }
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
}
}
}
},
"data_stream": {}
} }
PUT /_data_stream/my-data-stream PUT /_data_stream/my-data-stream

View File

@ -37,13 +37,6 @@ PUT /_index_template/my-index-template
"index_patterns": [ "my-data-stream*" ], "index_patterns": [ "my-data-stream*" ],
"data_stream": {}, "data_stream": {},
"template": { "template": {
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
}
}
},
"settings": { "settings": {
"index.lifecycle.name": "my-lifecycle-policy" "index.lifecycle.name": "my-lifecycle-policy"
} }

View File

@ -30,16 +30,7 @@ PUT /my-index/_alias/f-alias
PUT /_index_template/foo_data_stream PUT /_index_template/foo_data_stream
{ {
"index_patterns": [ "foo" ], "index_patterns": [ "foo" ],
"data_stream": {}, "data_stream": { }
"template": {
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
}
}
}
}
} }
PUT /_data_stream/foo PUT /_data_stream/foo

View File

@ -232,16 +232,7 @@ The API returns the following response:
PUT _index_template/template PUT _index_template/template
{ {
"index_patterns": ["my-data-stream*"], "index_patterns": ["my-data-stream*"],
"template": { "data_stream": { }
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
}
}
}
},
"data_stream": {}
} }
----------------------------------- -----------------------------------
// TEST // TEST

View File

@ -43,16 +43,7 @@ backing indices, the user can retrieve a document directly from `.ds-logs-000002
PUT /_index_template/logs_data_stream PUT /_index_template/logs_data_stream
{ {
"index_patterns": [ "logs*" ], "index_patterns": [ "logs*" ],
"data_stream": {}, "data_stream": { }
"template": {
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
}
}
}
}
} }
PUT /_data_stream/logs PUT /_data_stream/logs