Skip to content

Commit 9cd3700

Browse files
committed
[DOCS] Update examples
1 parent ffe7cfa commit 9cd3700

File tree

3 files changed

+55
-58
lines changed

3 files changed

+55
-58
lines changed

docs/en/stack/ml/getting-started-data.asciidoc

Lines changed: 51 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -96,64 +96,59 @@ for the fields. Mappings divide the documents in the index into logical groups
9696
and specify a field's characteristics, such as the field's searchability or
9797
whether or not it's _tokenized_, or broken up into separate words.
9898

99-
The sample data includes an `upload_server_metrics.sh` script, which you can use
100-
to create the mappings and load the data set. You can download it by clicking
101-
here: https://download.elastic.co/demos/machine_learning/gettingstarted/upload_server_metrics.sh[upload_server_metrics.sh]
99+
You can use scripts to create the mappings and load the data set. Download https://download.elastic.co/demos/machine_learning/gettingstarted/upload_server_metrics.sh[upload_server_metrics.sh] to the directory where you extracted the sample data.
102100
Before you run it, however, you must edit the USERNAME and PASSWORD variables
103-
with your actual user ID and password.
104-
If you do not have {security} enabled, use the
101+
with your actual user ID and password. If {security} is not enabled, use the
105102
https://download.elastic.co/demos/machine_learning/gettingstarted/upload_server_metrics_noauth.sh[upload_server_metrics_noauth.sh]
106103
script instead.
107104

108-
The script runs a command similar to the following example, which sets up a
109-
mapping for the data set:
105+
The script runs a `curl` command that makes the following create index API
106+
request:
110107

111108
[source,sh]
112109
----------------------------------
113-
curl -u elastic:x-pack-test-password -X PUT -H 'Content-Type: application/json'
114-
http://localhost:9200/server-metrics -d '{
115-
"settings":{
116-
"number_of_shards":1,
117-
"number_of_replicas":0
118-
},
119-
"mappings":{
120-
"metric":{
121-
"properties":{
122-
"@timestamp":{
123-
"type":"date"
124-
},
125-
"accept":{
126-
"type":"long"
127-
},
128-
"deny":{
129-
"type":"long"
130-
},
131-
"host":{
132-
"type":"keyword"
133-
},
134-
"response":{
135-
"type":"float"
136-
},
137-
"service":{
138-
"type":"keyword"
139-
},
140-
"total":{
141-
"type":"long"
142-
}
143-
}
110+
PUT server-metrics
111+
{
112+
"settings": {
113+
"number_of_shards":1,
114+
"number_of_replicas":0
115+
},
116+
"mappings": {
117+
"metric": {
118+
"properties":{
119+
"@timestamp": {
120+
"type":"date"
121+
},
122+
"accept": {
123+
"type":"long"
124+
},
125+
"deny": {
126+
"type":"long"
127+
},
128+
"host": {
129+
"type":"keyword"
130+
},
131+
"response": {
132+
"type":"float"
133+
},
134+
"service": {
135+
"type":"keyword"
136+
},
137+
"total": {
138+
"type":"long"
139+
}
144140
}
145-
}
146-
}'
141+
}
142+
}
143+
}
147144
----------------------------------
148-
// NOTCONSOLE
145+
// CONSOLE
149146

150-
NOTE: If you run this command (or similar commands in subsequent examples), you
151-
must replace `x-pack-test-password` with your actual password. If {security} is
152-
not enabled, you can omit the `-u` parameter.
147+
To learn more about mappings and data types, see {ref}/mapping.html[Mapping].
153148

154-
You can then use the {es} `bulk` API to load the data set. The
155-
`upload_server_metrics.sh` script runs commands similar to the following
156-
example, which loads the four JSON files:
149+
You can then use the bulk API to load the sample data set. The
150+
`upload_server_metrics.sh` script runs commands similar to the following example,
151+
which loads the four JSON files:
157152

158153
[source,sh]
159154
----------------------------------
@@ -171,19 +166,21 @@ http://localhost:9200/server-metrics/_bulk --data-binary "@server-metrics_4.json
171166
----------------------------------
172167
// NOTCONSOLE
173168

174-
TIP: This will upload 200MB of data. This is split into 4 files as there is a
175-
maximum 100MB limit when using the `_bulk` API.
169+
NOTE: If you want to try running these commands, you must specify a valid user
170+
ID and password in the `-u` parameter. If {security} is not enabled, you can
171+
omit the `-u` parameter.
176172

177-
These commands might take some time to run, depending on the computing resources
178-
available.
173+
These commands upload 200MB of data and might take some time to run, depending
174+
on the computing resources available.
179175

180-
You can verify that the data was loaded successfully with the following command:
176+
You can verify that the data was loaded successfully by running the cat indices
177+
API:
181178

182179
[source,sh]
183180
----------------------------------
184-
curl 'http://localhost:9200/_cat/indices?v' -u elastic:x-pack-test-password
181+
GET _cat/indices?v
185182
----------------------------------
186-
// NOTCONSOLE
183+
// CONSOLE
187184

188185
You should see output similar to the following:
189186

docs/en/stack/ml/getting-started-multi.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ When the job is created, you can choose to view the results, continue the job in
123123
real-time, and create a watch. In this tutorial, we will proceed to view the
124124
results.
125125

126-
TIP: The `create_multi_metic.sh` script creates a similar job and {dfeed} by
126+
TIP: The `create_multi_metric.sh` script creates a similar job and {dfeed} by
127127
using the {ml} APIs. You can download that script by clicking
128128
here: https://download.elastic.co/demos/machine_learning/gettingstarted/create_multi_metric.sh[create_multi_metric.sh] Before you run it, you must edit the USERNAME and PASSWORD variables
129-
with your actual user ID and password. If you do not have {security} enabled, use the
129+
with your actual user ID and password. If {security} is not enabled, use the
130130
https://download.elastic.co/demos/machine_learning/gettingstarted/create_multi_metric_noauth.sh[create_multi_metric_noauth.sh]
131131
script instead. For API reference information, see {ref}/ml-apis.html[Machine Learning APIs].
132132

docs/en/stack/ml/getting-started-single.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ When the job is created, you can choose to view the results, continue the job
128128
in real-time, and create a watch. In this tutorial, we will look at how to
129129
manage jobs and {dfeeds} before we view the results.
130130

131-
TIP: The `create_single_metic.sh` script creates a similar job and {dfeed} by
131+
TIP: The `create_single_metric.sh` script creates a similar job and {dfeed} by
132132
using the {ml} APIs. You can download that script by clicking
133133
here: https://download.elastic.co/demos/machine_learning/gettingstarted/create_single_metric.sh[create_single_metric.sh] Before you run it, you must edit the USERNAME and PASSWORD variables
134-
with your actual user ID and password. If you do not have {security} enabled, use the
134+
with your actual user ID and password. If {security} is not enabled, use the
135135
https://download.elastic.co/demos/machine_learning/gettingstarted/create_single_metric_noauth.sh[create_single_metric_noauth.sh]
136136
script instead. For API reference information, see {ref}/ml-apis.html[Machine Learning APIs].
137137

0 commit comments

Comments
 (0)