A hint: This file contains one or more very long lines, so maybe it is better readable using the pure text view mode that shows the contents as wrapped lines within the browser window.
1 import org.elasticsearch.gradle.test.NodeInfo 2 3 import java.nio.charset.StandardCharsets 4 5 apply plugin: 'elasticsearch.docs-test' 6 7 /* List of files that have snippets that probably should be converted to 8 * `// CONSOLE` and `// TESTRESPONSE` but have yet to be converted. Try and 9 * only remove entries from this list. When it is empty we'll remove it 10 * entirely and have a party! There will be cake and everything.... */ 11 buildRestTests.expectedUnconvertedCandidates = [ 12 'en/rest-api/watcher/put-watch.asciidoc', 13 'en/security/authentication/user-cache.asciidoc', 14 'en/security/authorization/run-as-privilege.asciidoc', 15 'en/security/tribe-clients-integrations/http.asciidoc', 16 'en/rest-api/watcher/stats.asciidoc', 17 'en/watcher/example-watches/watching-time-series-data.asciidoc', 18 ] 19 20 dependencies { 21 // "org.elasticsearch.plugin:x-pack-core:${version}" doesn't work with idea because the testArtifacts are also here 22 testCompile project(path: xpackModule('core'), configuration: 'default') 23 testCompile project(path: xpackModule('core'), configuration: 'testArtifacts') 24 testCompile project(path: xpackProject('plugin').path, configuration: 'testArtifacts') 25 } 26 27 Closure waitWithAuth = { NodeInfo node, AntBuilder ant -> 28 File tmpFile = new File(node.cwd, 'wait.success') 29 // wait up to twenty seconds 30 final long stopTime = System.currentTimeMillis() + 20000L; 31 Exception lastException = null; 32 while (System.currentTimeMillis() < stopTime) { 33 lastException = null; 34 // we use custom wait logic here as the elastic user is not available immediately and ant.get will fail when a 401 is returned 35 HttpURLConnection httpURLConnection = null; 36 try { 37 httpURLConnection = (HttpURLConnection) new URL("http://${node.httpUri()}/_cluster/health").openConnection(); 38 httpURLConnection.setRequestProperty("Authorization", "Basic " + 39 Base64.getEncoder().encodeToString("test_admin:x-pack-test-password".getBytes(StandardCharsets.UTF_8))); 40 httpURLConnection.setRequestMethod("GET"); 41 httpURLConnection.setConnectTimeout(1000); 42 httpURLConnection.setReadTimeout(30000); 43 httpURLConnection.connect(); 44 if (httpURLConnection.getResponseCode() == 200) { 45 tmpFile.withWriter StandardCharsets.UTF_8.name(), { 46 it.write(httpURLConnection.getInputStream().getText(StandardCharsets.UTF_8.name())) 47 } 48 break; 49 } 50 } catch (Exception e) { 51 logger.debug("failed to call cluster health", e) 52 lastException = e 53 } finally { 54 if (httpURLConnection != null) { 55 httpURLConnection.disconnect(); 56 } 57 } 58 59 // did not start, so wait a bit before trying again 60 Thread.sleep(500L); 61 } 62 if (tmpFile.exists() == false && lastException != null) { 63 logger.error("final attempt of calling cluster health failed", lastException) 64 } 65 return tmpFile.exists() 66 } 67 68 // copy xpack rest api 69 File xpackResources = new File(xpackProject('plugin').projectDir, 'src/test/resources') 70 project.copyRestSpec.from(xpackResources) { 71 include 'rest-api-spec/api/**' 72 } 73 integTestCluster { 74 setting 'xpack.security.enabled', 'true' 75 setting 'xpack.security.authc.api_key.enabled', 'true' 76 setting 'xpack.security.authc.token.enabled', 'true' 77 // Disable monitoring exporters for the docs tests 78 setting 'xpack.monitoring.exporters._local.type', 'local' 79 setting 'xpack.monitoring.exporters._local.enabled', 'false' 80 setting 'xpack.license.self_generated.type', 'trial' 81 setupCommand 'setupTestAdmin', 82 'bin/elasticsearch-users', 'useradd', 'test_admin', '-p', 'x-pack-test-password', '-r', 'superuser' 83 waitCondition = waitWithAuth 84 } 85 86 87 88 buildRestTests.docs = fileTree(projectDir) { 89 // No snippets in here! 90 exclude 'build.gradle' 91 // That is where the snippets go, not where they come from! 92 exclude 'build' 93 // These file simply doesn't pass yet. We should figure out how to fix them. 94 exclude 'en/watcher/reference/actions.asciidoc' 95 } 96 97 Map<String, String> setups = buildRestTests.setups 98 setups['my_inactive_watch'] = ''' 99 - do: 100 xpack.watcher.put_watch: 101 id: "my_watch" 102 master_timeout: "40s" 103 active: false 104 body: > 105 { 106 "trigger": { 107 "schedule": { 108 "hourly": { 109 "minute": [ 0, 5 ] 110 } 111 } 112 }, 113 "input": { 114 "simple": { 115 "payload": { 116 "send": "yes" 117 } 118 } 119 }, 120 "condition": { 121 "always": {} 122 }, 123 "actions": { 124 "test_index": { 125 "index": { 126 "index": "test", 127 "doc_type": "test2" 128 } 129 } 130 } 131 } 132 - match: { _id: "my_watch" } 133 ''' 134 setups['my_active_watch'] = setups['my_inactive_watch'].replace( 135 'active: false', 'active: true') 136 137 // Used by SQL because it looks SQL-ish 138 setups['library'] = ''' 139 - do: 140 indices.create: 141 index: library 142 body: 143 settings: 144 number_of_shards: 1 145 number_of_replicas: 1 146 mappings: 147 book: 148 properties: 149 name: 150 type: text 151 fields: 152 keyword: 153 type: keyword 154 author: 155 type: text 156 fields: 157 keyword: 158 type: keyword 159 release_date: 160 type: date 161 page_count: 162 type: short 163 - do: 164 bulk: 165 index: library 166 type: book 167 refresh: true 168 body: | 169 {"index":{"_id": "Leviathan Wakes"}} 170 {"name": "Leviathan Wakes", "author": "James S.A. Corey", "release_date": "2011-06-02", "page_count": 561} 171 {"index":{"_id": "Hyperion"}} 172 {"name": "Hyperion", "author": "Dan Simmons", "release_date": "1989-05-26", "page_count": 482} 173 {"index":{"_id": "Dune"}} 174 {"name": "Dune", "author": "Frank Herbert", "release_date": "1965-06-01", "page_count": 604} 175 {"index":{"_id": "Dune Messiah"}} 176 {"name": "Dune Messiah", "author": "Frank Herbert", "release_date": "1969-10-15", "page_count": 331} 177 {"index":{"_id": "Children of Dune"}} 178 {"name": "Children of Dune", "author": "Frank Herbert", "release_date": "1976-04-21", "page_count": 408} 179 {"index":{"_id": "God Emperor of Dune"}} 180 {"name": "God Emperor of Dune", "author": "Frank Herbert", "release_date": "1981-05-28", "page_count": 454} 181 {"index":{"_id": "Consider Phlebas"}} 182 {"name": "Consider Phlebas", "author": "Iain M. Banks", "release_date": "1987-04-23", "page_count": 471} 183 {"index":{"_id": "Pandora's Star"}} 184 {"name": "Pandora's Star", "author": "Peter F. Hamilton", "release_date": "2004-03-02", "page_count": 768} 185 {"index":{"_id": "Revelation Space"}} 186 {"name": "Revelation Space", "author": "Alastair Reynolds", "release_date": "2000-03-15", "page_count": 585} 187 {"index":{"_id": "A Fire Upon the Deep"}} 188 {"name": "A Fire Upon the Deep", "author": "Vernor Vinge", "release_date": "1992-06-01", "page_count": 613} 189 {"index":{"_id": "Ender's Game"}} 190 {"name": "Ender's Game", "author": "Orson Scott Card", "release_date": "1985-06-01", "page_count": 324} 191 {"index":{"_id": "1984"}} 192 {"name": "1984", "author": "George Orwell", "release_date": "1985-06-01", "page_count": 328} 193 {"index":{"_id": "Fahrenheit 451"}} 194 {"name": "Fahrenheit 451", "author": "Ray Bradbury", "release_date": "1953-10-15", "page_count": 227} 195 {"index":{"_id": "Brave New World"}} 196 {"name": "Brave New World", "author": "Aldous Huxley", "release_date": "1932-06-01", "page_count": 268} 197 {"index":{"_id": "Foundation"}} 198 {"name": "Foundation", "author": "Isaac Asimov", "release_date": "1951-06-01", "page_count": 224} 199 {"index":{"_id": "The Giver"}} 200 {"name": "The Giver", "author": "Lois Lowry", "release_date": "1993-04-26", "page_count": 208} 201 {"index":{"_id": "Slaughterhouse-Five"}} 202 {"name": "Slaughterhouse-Five", "author": "Kurt Vonnegut", "release_date": "1969-06-01", "page_count": 275} 203 {"index":{"_id": "The Hitchhiker's Guide to the Galaxy"}} 204 {"name": "The Hitchhiker's Guide to the Galaxy", "author": "Douglas Adams", "release_date": "1979-10-12", "page_count": 180} 205 {"index":{"_id": "Snow Crash"}} 206 {"name": "Snow Crash", "author": "Neal Stephenson", "release_date": "1992-06-01", "page_count": 470} 207 {"index":{"_id": "Neuromancer"}} 208 {"name": "Neuromancer", "author": "William Gibson", "release_date": "1984-07-01", "page_count": 271} 209 {"index":{"_id": "The Handmaid's Tale"}} 210 {"name": "The Handmaid's Tale", "author": "Margaret Atwood", "release_date": "1985-06-01", "page_count": 311} 211 {"index":{"_id": "Starship Troopers"}} 212 {"name": "Starship Troopers", "author": "Robert A. Heinlein", "release_date": "1959-12-01", "page_count": 335} 213 {"index":{"_id": "The Left Hand of Darkness"}} 214 {"name": "The Left Hand of Darkness", "author": "Ursula K. Le Guin", "release_date": "1969-06-01", "page_count": 304} 215 {"index":{"_id": "The Moon is a Harsh Mistress"}} 216 {"name": "The Moon is a Harsh Mistress", "author": "Robert A. Heinlein", "release_date": "1966-04-01", "page_count": 288} 217 218 ''' 219 setups['sample_job'] = ''' 220 - do: 221 xpack.ml.put_job: 222 job_id: "sample_job" 223 body: > 224 { 225 "description" : "Very basic job", 226 "analysis_config" : { 227 "bucket_span":"10m", 228 "detectors" :[ 229 { 230 "function": "count" 231 } 232 ]}, 233 "data_description" : { 234 "time_field":"timestamp", 235 "time_format": "epoch_ms" 236 } 237 } 238 ''' 239 setups['farequote_index'] = ''' 240 - do: 241 indices.create: 242 index: farequote 243 body: 244 settings: 245 number_of_shards: 1 246 number_of_replicas: 0 247 mappings: 248 metric: 249 properties: 250 time: 251 type: date 252 responsetime: 253 type: float 254 airline: 255 type: keyword 256 doc_count: 257 type: integer 258 ''' 259 setups['farequote_data'] = setups['farequote_index'] + ''' 260 - do: 261 bulk: 262 index: farequote 263 type: metric 264 refresh: true 265 body: | 266 {"index": {"_id":"1"}} 267 {"airline":"JZA","responsetime":990.4628,"time":"2016-02-07T00:00:00+0000", "doc_count": 5} 268 {"index": {"_id":"2"}} 269 {"airline":"JBU","responsetime":877.5927,"time":"2016-02-07T00:00:00+0000", "doc_count": 23} 270 {"index": {"_id":"3"}} 271 {"airline":"KLM","responsetime":1355.4812,"time":"2016-02-07T00:00:00+0000", "doc_count": 42} 272 ''' 273 setups['farequote_job'] = setups['farequote_data'] + ''' 274 - do: 275 xpack.ml.put_job: 276 job_id: "farequote" 277 body: > 278 { 279 "analysis_config": { 280 "bucket_span": "60m", 281 "detectors": [{ 282 "function": "mean", 283 "field_name": "responsetime", 284 "by_field_name": "airline" 285 }], 286 "summary_count_field_name": "doc_count" 287 }, 288 "data_description": { 289 "time_field": "time" 290 } 291 } 292 ''' 293 setups['farequote_datafeed'] = setups['farequote_job'] + ''' 294 - do: 295 xpack.ml.put_datafeed: 296 datafeed_id: "datafeed-farequote" 297 body: > 298 { 299 "job_id":"farequote", 300 "indexes":"farequote" 301 } 302 ''' 303 setups['ml_filter_safe_domains'] = ''' 304 - do: 305 xpack.ml.put_filter: 306 filter_id: "safe_domains" 307 body: > 308 { 309 "description": "A list of safe domains", 310 "items": ["*.google.com", "wikipedia.org"] 311 } 312 ''' 313 setups['server_metrics_index'] = ''' 314 - do: 315 indices.create: 316 index: server-metrics 317 body: 318 settings: 319 number_of_shards: 1 320 number_of_replicas: 0 321 mappings: 322 metric: 323 properties: 324 timestamp: 325 type: date 326 total: 327 type: long 328 ''' 329 setups['server_metrics_data'] = setups['server_metrics_index'] + ''' 330 - do: 331 bulk: 332 index: server-metrics 333 type: metric 334 refresh: true 335 body: | 336 {"index": {"_id":"1177"}} 337 {"timestamp":"2017-03-23T13:00:00","total":40476} 338 {"index": {"_id":"1178"}} 339 {"timestamp":"2017-03-23T13:00:00","total":15287} 340 {"index": {"_id":"1179"}} 341 {"timestamp":"2017-03-23T13:00:00","total":-776} 342 {"index": {"_id":"1180"}} 343 {"timestamp":"2017-03-23T13:00:00","total":11366} 344 {"index": {"_id":"1181"}} 345 {"timestamp":"2017-03-23T13:00:00","total":3606} 346 {"index": {"_id":"1182"}} 347 {"timestamp":"2017-03-23T13:00:00","total":19006} 348 {"index": {"_id":"1183"}} 349 {"timestamp":"2017-03-23T13:00:00","total":38613} 350 {"index": {"_id":"1184"}} 351 {"timestamp":"2017-03-23T13:00:00","total":19516} 352 {"index": {"_id":"1185"}} 353 {"timestamp":"2017-03-23T13:00:00","total":-258} 354 {"index": {"_id":"1186"}} 355 {"timestamp":"2017-03-23T13:00:00","total":9551} 356 {"index": {"_id":"1187"}} 357 {"timestamp":"2017-03-23T13:00:00","total":11217} 358 {"index": {"_id":"1188"}} 359 {"timestamp":"2017-03-23T13:00:00","total":22557} 360 {"index": {"_id":"1189"}} 361 {"timestamp":"2017-03-23T13:00:00","total":40508} 362 {"index": {"_id":"1190"}} 363 {"timestamp":"2017-03-23T13:00:00","total":11887} 364 {"index": {"_id":"1191"}} 365 {"timestamp":"2017-03-23T13:00:00","total":31659} 366 ''' 367 setups['server_metrics_job'] = setups['server_metrics_data'] + ''' 368 - do: 369 xpack.ml.put_job: 370 job_id: "total-requests" 371 body: > 372 { 373 "description" : "Total sum of requests", 374 "analysis_config" : { 375 "bucket_span":"10m", 376 "detectors" :[ 377 { 378 "detector_description": "Sum of total", 379 "function": "sum", 380 "field_name": "total" 381 } 382 ]}, 383 "data_description" : { 384 "time_field":"timestamp", 385 "time_format": "epoch_ms" 386 } 387 } 388 ''' 389 setups['server_metrics_datafeed'] = setups['server_metrics_job'] + ''' 390 - do: 391 xpack.ml.put_datafeed: 392 datafeed_id: "datafeed-total-requests" 393 body: > 394 { 395 "job_id":"total-requests", 396 "indexes":"server-metrics" 397 } 398 ''' 399 setups['server_metrics_openjob'] = setups['server_metrics_datafeed'] + ''' 400 - do: 401 xpack.ml.open_job: 402 job_id: "total-requests" 403 ''' 404 setups['server_metrics_startdf'] = setups['server_metrics_openjob'] + ''' 405 - do: 406 xpack.ml.start_datafeed: 407 datafeed_id: "datafeed-total-requests" 408 ''' 409 setups['calendar_outages'] = ''' 410 - do: 411 xpack.ml.put_calendar: 412 calendar_id: "planned-outages" 413 ''' 414 setups['calendar_outages_addevent'] = setups['calendar_outages'] + ''' 415 - do: 416 xpack.ml.post_calendar_events: 417 calendar_id: "planned-outages" 418 body: > 419 { "description": "event 1", "start_time": "2017-12-01T00:00:00Z", "end_time": "2017-12-02T00:00:00Z", "calendar_id": "planned-outages" } 420 421 422 ''' 423 setups['calendar_outages_openjob'] = setups['server_metrics_openjob'] + ''' 424 - do: 425 xpack.ml.put_calendar: 426 calendar_id: "planned-outages" 427 ''' 428 setups['calendar_outages_addjob'] = setups['server_metrics_openjob'] + ''' 429 - do: 430 xpack.ml.put_calendar: 431 calendar_id: "planned-outages" 432 body: > 433 { 434 "job_ids": ["total-requests"] 435 } 436 ''' 437 setups['calendar_outages_addevent'] = setups['calendar_outages_addjob'] + ''' 438 - do: 439 xpack.ml.post_calendar_events: 440 calendar_id: "planned-outages" 441 body: > 442 { "events" : [ 443 { "description": "event 1", "start_time": "1513641600000", "end_time": "1513728000000"}, 444 { "description": "event 2", "start_time": "1513814400000", "end_time": "1513900800000"}, 445 { "description": "event 3", "start_time": "1514160000000", "end_time": "1514246400000"} 446 ]} 447 ''' 448 setups['role_mapping'] = ''' 449 - do: 450 xpack.security.put_role_mapping: 451 name: "mapping1" 452 body: > 453 { 454 "enabled": true, 455 "roles": [ "user" ], 456 "rules": { "field": { "username": "*" } } 457 } 458 ''' 459 setups['sensor_rollup_job'] = ''' 460 - do: 461 indices.create: 462 index: sensor-1 463 body: 464 settings: 465 number_of_shards: 1 466 number_of_replicas: 0 467 mappings: 468 _doc: 469 properties: 470 timestamp: 471 type: date 472 temperature: 473 type: long 474 voltage: 475 type: float 476 node: 477 type: keyword 478 - do: 479 xpack.rollup.put_job: 480 id: "sensor" 481 body: > 482 { 483 "index_pattern": "sensor-*", 484 "rollup_index": "sensor_rollup", 485 "cron": "*/30 * * * * ?", 486 "page_size" :1000, 487 "groups" : { 488 "date_histogram": { 489 "field": "timestamp", 490 "interval": "1h", 491 "delay": "7d" 492 }, 493 "terms": { 494 "fields": ["node"] 495 } 496 }, 497 "metrics": [ 498 { 499 "field": "temperature", 500 "metrics": ["min", "max", "sum"] 501 }, 502 { 503 "field": "voltage", 504 "metrics": ["avg"] 505 } 506 ] 507 } 508 ''' 509 setups['sensor_started_rollup_job'] = ''' 510 - do: 511 indices.create: 512 index: sensor-1 513 body: 514 settings: 515 number_of_shards: 1 516 number_of_replicas: 0 517 mappings: 518 _doc: 519 properties: 520 timestamp: 521 type: date 522 temperature: 523 type: long 524 voltage: 525 type: float 526 node: 527 type: keyword 528 529 - do: 530 bulk: 531 index: sensor-1 532 type: _doc 533 refresh: true 534 body: | 535 {"index":{}} 536 {"timestamp": 1516729294000, "temperature": 200, "voltage": 5.2, "node": "a"} 537 {"index":{}} 538 {"timestamp": 1516642894000, "temperature": 201, "voltage": 5.8, "node": "b"} 539 {"index":{}} 540 {"timestamp": 1516556494000, "temperature": 202, "voltage": 5.1, "node": "a"} 541 {"index":{}} 542 {"timestamp": 1516470094000, "temperature": 198, "voltage": 5.6, "node": "b"} 543 {"index":{}} 544 {"timestamp": 1516383694000, "temperature": 200, "voltage": 4.2, "node": "c"} 545 {"index":{}} 546 {"timestamp": 1516297294000, "temperature": 202, "voltage": 4.0, "node": "c"} 547 548 - do: 549 xpack.rollup.put_job: 550 id: "sensor" 551 body: > 552 { 553 "index_pattern": "sensor-*", 554 "rollup_index": "sensor_rollup", 555 "cron": "* * * * * ?", 556 "page_size" :1000, 557 "groups" : { 558 "date_histogram": { 559 "field": "timestamp", 560 "interval": "1h", 561 "delay": "7d" 562 }, 563 "terms": { 564 "fields": ["node"] 565 } 566 }, 567 "metrics": [ 568 { 569 "field": "temperature", 570 "metrics": ["min", "max", "sum"] 571 }, 572 { 573 "field": "voltage", 574 "metrics": ["avg"] 575 } 576 ] 577 } 578 - do: 579 xpack.rollup.start_job: 580 id: "sensor" 581 ''' 582 583 setups['sensor_index'] = ''' 584 - do: 585 indices.create: 586 index: sensor-1 587 body: 588 settings: 589 number_of_shards: 1 590 number_of_replicas: 0 591 mappings: 592 _doc: 593 properties: 594 timestamp: 595 type: date 596 temperature: 597 type: long 598 voltage: 599 type: float 600 node: 601 type: keyword 602 load: 603 type: double 604 net_in: 605 type: long 606 net_out: 607 type: long 608 hostname: 609 type: keyword 610 datacenter: 611 type: keyword 612 ''' 613 614 setups['sensor_prefab_data'] = ''' 615 - do: 616 indices.create: 617 index: sensor-1 618 body: 619 settings: 620 number_of_shards: 1 621 number_of_replicas: 0 622 mappings: 623 _doc: 624 properties: 625 timestamp: 626 type: date 627 temperature: 628 type: long 629 voltage: 630 type: float 631 node: 632 type: keyword 633 - do: 634 indices.create: 635 index: sensor_rollup 636 body: 637 settings: 638 number_of_shards: 1 639 number_of_replicas: 0 640 mappings: 641 _doc: 642 properties: 643 node.terms.value: 644 type: keyword 645 temperature.sum.value: 646 type: double 647 temperature.max.value: 648 type: double 649 temperature.min.value: 650 type: double 651 timestamp.date_histogram.time_zone: 652 type: keyword 653 timestamp.date_histogram.interval: 654 type: keyword 655 timestamp.date_histogram.timestamp: 656 type: date 657 timestamp.date_histogram._count: 658 type: long 659 voltage.avg.value: 660 type: double 661 voltage.avg._count: 662 type: long 663 _rollup.id: 664 type: keyword 665 _rollup.version: 666 type: long 667 _meta: 668 _rollup: 669 sensor: 670 cron: "* * * * * ?" 671 rollup_index: "sensor_rollup" 672 index_pattern: "sensor-*" 673 timeout: "20s" 674 page_size: 1000 675 groups: 676 date_histogram: 677 field: "timestamp" 678 interval: "7d" 679 time_zone: "UTC" 680 terms: 681 fields: 682 - "node" 683 id: sensor 684 metrics: 685 - field: "temperature" 686 metrics: 687 - min 688 - max 689 - sum 690 - field: "voltage" 691 metrics: 692 - avg 693 694 - do: 695 bulk: 696 index: sensor_rollup 697 type: _doc 698 refresh: true 699 body: | 700 {"index":{}} 701 {"node.terms.value":"b","temperature.sum.value":201.0,"temperature.max.value":201.0,"timestamp.date_histogram.time_zone":"UTC","temperature.min.value":201.0,"timestamp.date_histogram._count":1,"timestamp.date_histogram.interval":"1h","_rollup.computed":["temperature.sum","temperature.min","voltage.avg","temperature.max","node.terms","timestamp.date_histogram"],"voltage.avg.value":5.800000190734863,"node.terms._count":1,"_rollup.version":1,"timestamp.date_histogram.timestamp":1516640400000,"voltage.avg._count":1.0,"_rollup.id":"sensor"} 702 {"index":{}} 703 {"node.terms.value":"c","temperature.sum.value":200.0,"temperature.max.value":200.0,"timestamp.date_histogram.time_zone":"UTC","temperature.min.value":200.0,"timestamp.date_histogram._count":1,"timestamp.date_histogram.interval":"1h","_rollup.computed":["temperature.sum","temperature.min","voltage.avg","temperature.max","node.terms","timestamp.date_histogram"],"voltage.avg.value":4.199999809265137,"node.terms._count":1,"_rollup.version":1,"timestamp.date_histogram.timestamp":1516381200000,"voltage.avg._count":1.0,"_rollup.id":"sensor"} 704 {"index":{}} 705 {"node.terms.value":"a","temperature.sum.value":202.0,"temperature.max.value":202.0,"timestamp.date_histogram.time_zone":"UTC","temperature.min.value":202.0,"timestamp.date_histogram._count":1,"timestamp.date_histogram.interval":"1h","_rollup.computed":["temperature.sum","temperature.min","voltage.avg","temperature.max","node.terms","timestamp.date_histogram"],"voltage.avg.value":5.099999904632568,"node.terms._count":1,"_rollup.version":1,"timestamp.date_histogram.timestamp":1516554000000,"voltage.avg._count":1.0,"_rollup.id":"sensor"} 706 {"index":{}} 707 {"node.terms.value":"a","temperature.sum.value":200.0,"temperature.max.value":200.0,"timestamp.date_histogram.time_zone":"UTC","temperature.min.value":200.0,"timestamp.date_histogram._count":1,"timestamp.date_histogram.interval":"1h","_rollup.computed":["temperature.sum","temperature.min","voltage.avg","temperature.max","node.terms","timestamp.date_histogram"],"voltage.avg.value":5.199999809265137,"node.terms._count":1,"_rollup.version":1,"timestamp.date_histogram.timestamp":1516726800000,"voltage.avg._count":1.0,"_rollup.id":"sensor"} 708 {"index":{}} 709 {"node.terms.value":"b","temperature.sum.value":198.0,"temperature.max.value":198.0,"timestamp.date_histogram.time_zone":"UTC","temperature.min.value":198.0,"timestamp.date_histogram._count":1,"timestamp.date_histogram.interval":"1h","_rollup.computed":["temperature.sum","temperature.min","voltage.avg","temperature.max","node.terms","timestamp.date_histogram"],"voltage.avg.value":5.599999904632568,"node.terms._count":1,"_rollup.version":1,"timestamp.date_histogram.timestamp":1516467600000,"voltage.avg._count":1.0,"_rollup.id":"sensor"} 710 {"index":{}} 711 {"node.terms.value":"c","temperature.sum.value":202.0,"temperature.max.value":202.0,"timestamp.date_histogram.time_zone":"UTC","temperature.min.value":202.0,"timestamp.date_histogram._count":1,"timestamp.date_histogram.interval":"1h","_rollup.computed":["temperature.sum","temperature.min","voltage.avg","temperature.max","node.terms","timestamp.date_histogram"],"voltage.avg.value":4.0,"node.terms._count":1,"_rollup.version":1,"timestamp.date_histogram.timestamp":1516294800000,"voltage.avg._count":1.0,"_rollup.id":"sensor"} 712 713 ''' 714 setups['admin_role'] = ''' 715 - do: 716 xpack.security.put_role: 717 name: "my_admin_role" 718 body: > 719 { 720 "cluster": ["all"], 721 "indices": [ 722 {"names": ["index1", "index2" ], "privileges": ["all"], "field_security" : {"grant" : [ "title", "body" ]}} 723 ], 724 "run_as": [ "other_user" ], 725 "metadata" : {"version": 1} 726 } 727 ''' 728 setups['jacknich_user'] = ''' 729 - do: 730 xpack.security.put_user: 731 username: "jacknich" 732 body: > 733 { 734 "password" : "test-password", 735 "roles" : [ "admin", "other_role1" ], 736 "full_name" : "Jack Nicholson", 737 "email" : "jacknich@example.com", 738 "metadata" : { "intelligence" : 7 } 739 } 740 ''' 741 setups['app0102_privileges'] = ''' 742 - do: 743 xpack.security.put_privileges: 744 body: > 745 { 746 "myapp": { 747 "read": { 748 "application": "myapp", 749 "name": "read", 750 "actions": [ 751 "data:read/*", 752 "action:login" ], 753 "metadata": { 754 "description": "Read access to myapp" 755 } 756 } 757 } 758 } 759 '''