2017-04-21 11:23:27 -04:00
|
|
|
apply plugin: 'elasticsearch.docs-test'
|
|
|
|
|
|
|
|
/* List of files that have snippets that probably should be converted to
|
|
|
|
* `// CONSOLE` and `// TESTRESPONSE` but have yet to be converted. Try and
|
|
|
|
* only remove entries from this list. When it is empty we'll remove it
|
|
|
|
* entirely and have a party! There will be cake and everything.... */
|
|
|
|
buildRestTests.expectedUnconvertedCandidates = [
|
2019-11-14 06:01:23 -05:00
|
|
|
'en/rest-api/watcher/put-watch.asciidoc',
|
|
|
|
'en/security/authentication/user-cache.asciidoc',
|
|
|
|
'en/security/authorization/run-as-privilege.asciidoc',
|
|
|
|
'en/security/ccs-clients-integrations/http.asciidoc',
|
|
|
|
'en/rest-api/watcher/stats.asciidoc',
|
|
|
|
'en/watcher/example-watches/watching-time-series-data.asciidoc',
|
2017-04-21 11:23:27 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
dependencies {
|
2020-06-14 16:30:44 -04:00
|
|
|
testImplementation project(path: xpackModule('core'), configuration: 'default')
|
|
|
|
testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
|
|
|
|
testImplementation project(path: xpackProject('plugin').path, configuration: 'testArtifacts')
|
2017-04-21 11:23:27 -04:00
|
|
|
}
|
|
|
|
|
2020-02-26 09:13:41 -05:00
|
|
|
restResources {
|
|
|
|
restApi {
|
|
|
|
includeCore '*'
|
|
|
|
includeXpack '*'
|
|
|
|
}
|
2018-02-23 11:03:17 -05:00
|
|
|
}
|
2019-05-22 07:25:54 -04:00
|
|
|
|
|
|
|
testClusters.integTest {
|
2019-11-14 06:01:23 -05:00
|
|
|
extraConfigFile 'op-jwks.json', xpackProject('test:idp-fixture').file("oidc/op-jwks.json")
|
|
|
|
extraConfigFile 'idp-docs-metadata.xml', xpackProject('test:idp-fixture').file("idp/shibboleth-idp/metadata/idp-docs-metadata.xml")
|
|
|
|
extraConfigFile 'testClient.crt', xpackProject('plugin:security').file("src/test/resources/org/elasticsearch/xpack/security/action/pki_delegation/testClient.crt")
|
|
|
|
setting 'xpack.security.enabled', 'true'
|
|
|
|
setting 'xpack.security.authc.api_key.enabled', 'true'
|
|
|
|
setting 'xpack.security.authc.token.enabled', 'true'
|
|
|
|
// Disable monitoring exporters for the docs tests
|
|
|
|
setting 'xpack.monitoring.exporters._local.type', 'local'
|
|
|
|
setting 'xpack.monitoring.exporters._local.enabled', 'false'
|
|
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
|
|
|
setting 'xpack.security.authc.realms.file.file.order', '0'
|
|
|
|
setting 'xpack.security.authc.realms.native.native.order', '1'
|
|
|
|
setting 'xpack.security.authc.realms.oidc.oidc1.order', '2'
|
|
|
|
setting 'xpack.security.authc.realms.oidc.oidc1.op.issuer', 'http://127.0.0.1:8080'
|
|
|
|
setting 'xpack.security.authc.realms.oidc.oidc1.op.authorization_endpoint', "http://127.0.0.1:8080/c2id-login"
|
|
|
|
setting 'xpack.security.authc.realms.oidc.oidc1.op.token_endpoint', "http://127.0.0.1:8080/c2id/token"
|
|
|
|
setting 'xpack.security.authc.realms.oidc.oidc1.op.jwkset_path', 'op-jwks.json'
|
|
|
|
setting 'xpack.security.authc.realms.oidc.oidc1.rp.redirect_uri', 'https://my.fantastic.rp/cb'
|
|
|
|
setting 'xpack.security.authc.realms.oidc.oidc1.rp.client_id', 'elasticsearch-rp'
|
|
|
|
keystore 'xpack.security.authc.realms.oidc.oidc1.rp.client_secret', 'b07efb7a1cf6ec9462afe7b6d3ab55c6c7880262aa61ac28dded292aca47c9a2'
|
|
|
|
setting 'xpack.security.authc.realms.oidc.oidc1.rp.response_type', 'id_token'
|
|
|
|
setting 'xpack.security.authc.realms.oidc.oidc1.claims.principal', 'sub'
|
|
|
|
setting 'xpack.security.authc.realms.pki.pki1.order', '3'
|
|
|
|
setting 'xpack.security.authc.realms.pki.pki1.certificate_authorities', '[ "testClient.crt" ]'
|
|
|
|
setting 'xpack.security.authc.realms.pki.pki1.delegation.enabled', 'true'
|
|
|
|
setting 'xpack.security.authc.realms.saml.saml1.order', '4'
|
|
|
|
setting 'xpack.security.authc.realms.saml.saml1.idp.entity_id', 'https://my-idp.org'
|
|
|
|
setting 'xpack.security.authc.realms.saml.saml1.idp.metadata.path', 'idp-docs-metadata.xml'
|
|
|
|
setting 'xpack.security.authc.realms.saml.saml1.sp.entity_id', 'https://kibana.org'
|
|
|
|
setting 'xpack.security.authc.realms.saml.saml1.sp.acs', 'https://kibana.org/api/security/v1/saml'
|
|
|
|
setting 'xpack.security.authc.realms.saml.saml1.attributes.principal', 'uid'
|
|
|
|
setting 'xpack.security.authc.realms.saml.saml1.attributes.name', 'urn:oid:2.5.4.3'
|
|
|
|
user username: 'test_admin'
|
2017-04-21 11:23:27 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
buildRestTests.docs = fileTree(projectDir) {
|
2019-11-14 06:01:23 -05:00
|
|
|
// No snippets in here!
|
|
|
|
exclude 'build.gradle'
|
|
|
|
// That is where the snippets go, not where they come from!
|
|
|
|
exclude 'build'
|
|
|
|
// These file simply doesn't pass yet. We should figure out how to fix them.
|
|
|
|
exclude 'en/watcher/reference/actions.asciidoc'
|
|
|
|
exclude 'en/rest-api/security/ssl.asciidoc'
|
2017-04-21 11:23:27 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Map<String, String> setups = buildRestTests.setups
|
|
|
|
setups['my_inactive_watch'] = '''
|
|
|
|
- do:
|
2019-02-18 06:40:07 -05:00
|
|
|
watcher.put_watch:
|
2017-04-21 11:23:27 -04:00
|
|
|
id: "my_watch"
|
|
|
|
active: false
|
|
|
|
body: >
|
|
|
|
{
|
|
|
|
"trigger": {
|
|
|
|
"schedule": {
|
|
|
|
"hourly": {
|
|
|
|
"minute": [ 0, 5 ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"input": {
|
|
|
|
"simple": {
|
|
|
|
"payload": {
|
|
|
|
"send": "yes"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"condition": {
|
|
|
|
"always": {}
|
|
|
|
},
|
|
|
|
"actions": {
|
|
|
|
"test_index": {
|
|
|
|
"index": {
|
2019-01-30 14:12:13 -05:00
|
|
|
"index": "test"
|
2017-04-21 11:23:27 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
- match: { _id: "my_watch" }
|
|
|
|
'''
|
|
|
|
setups['my_active_watch'] = setups['my_inactive_watch'].replace(
|
2019-11-14 06:01:23 -05:00
|
|
|
'active: false', 'active: true')
|
2017-12-13 10:19:31 -05:00
|
|
|
|
|
|
|
// Used by SQL because it looks SQL-ish
|
|
|
|
setups['library'] = '''
|
|
|
|
- do:
|
|
|
|
indices.create:
|
|
|
|
index: library
|
|
|
|
body:
|
|
|
|
settings:
|
|
|
|
number_of_shards: 1
|
|
|
|
number_of_replicas: 1
|
|
|
|
mappings:
|
|
|
|
book:
|
|
|
|
properties:
|
|
|
|
name:
|
2017-12-18 20:57:50 -05:00
|
|
|
type: text
|
|
|
|
fields:
|
|
|
|
keyword:
|
|
|
|
type: keyword
|
2017-12-13 10:19:31 -05:00
|
|
|
author:
|
2017-12-18 20:57:50 -05:00
|
|
|
type: text
|
|
|
|
fields:
|
|
|
|
keyword:
|
|
|
|
type: keyword
|
2017-12-13 10:19:31 -05:00
|
|
|
release_date:
|
|
|
|
type: date
|
|
|
|
page_count:
|
|
|
|
type: short
|
|
|
|
- do:
|
|
|
|
bulk:
|
|
|
|
index: library
|
|
|
|
type: book
|
|
|
|
refresh: true
|
|
|
|
body: |
|
|
|
|
{"index":{"_id": "Leviathan Wakes"}}
|
|
|
|
{"name": "Leviathan Wakes", "author": "James S.A. Corey", "release_date": "2011-06-02", "page_count": 561}
|
|
|
|
{"index":{"_id": "Hyperion"}}
|
|
|
|
{"name": "Hyperion", "author": "Dan Simmons", "release_date": "1989-05-26", "page_count": 482}
|
|
|
|
{"index":{"_id": "Dune"}}
|
|
|
|
{"name": "Dune", "author": "Frank Herbert", "release_date": "1965-06-01", "page_count": 604}
|
2017-12-18 20:57:50 -05:00
|
|
|
{"index":{"_id": "Dune Messiah"}}
|
|
|
|
{"name": "Dune Messiah", "author": "Frank Herbert", "release_date": "1969-10-15", "page_count": 331}
|
|
|
|
{"index":{"_id": "Children of Dune"}}
|
|
|
|
{"name": "Children of Dune", "author": "Frank Herbert", "release_date": "1976-04-21", "page_count": 408}
|
|
|
|
{"index":{"_id": "God Emperor of Dune"}}
|
|
|
|
{"name": "God Emperor of Dune", "author": "Frank Herbert", "release_date": "1981-05-28", "page_count": 454}
|
2017-12-13 10:19:31 -05:00
|
|
|
{"index":{"_id": "Consider Phlebas"}}
|
|
|
|
{"name": "Consider Phlebas", "author": "Iain M. Banks", "release_date": "1987-04-23", "page_count": 471}
|
|
|
|
{"index":{"_id": "Pandora's Star"}}
|
|
|
|
{"name": "Pandora's Star", "author": "Peter F. Hamilton", "release_date": "2004-03-02", "page_count": 768}
|
|
|
|
{"index":{"_id": "Revelation Space"}}
|
|
|
|
{"name": "Revelation Space", "author": "Alastair Reynolds", "release_date": "2000-03-15", "page_count": 585}
|
|
|
|
{"index":{"_id": "A Fire Upon the Deep"}}
|
|
|
|
{"name": "A Fire Upon the Deep", "author": "Vernor Vinge", "release_date": "1992-06-01", "page_count": 613}
|
|
|
|
{"index":{"_id": "Ender's Game"}}
|
|
|
|
{"name": "Ender's Game", "author": "Orson Scott Card", "release_date": "1985-06-01", "page_count": 324}
|
|
|
|
{"index":{"_id": "1984"}}
|
|
|
|
{"name": "1984", "author": "George Orwell", "release_date": "1985-06-01", "page_count": 328}
|
|
|
|
{"index":{"_id": "Fahrenheit 451"}}
|
|
|
|
{"name": "Fahrenheit 451", "author": "Ray Bradbury", "release_date": "1953-10-15", "page_count": 227}
|
|
|
|
{"index":{"_id": "Brave New World"}}
|
|
|
|
{"name": "Brave New World", "author": "Aldous Huxley", "release_date": "1932-06-01", "page_count": 268}
|
|
|
|
{"index":{"_id": "Foundation"}}
|
|
|
|
{"name": "Foundation", "author": "Isaac Asimov", "release_date": "1951-06-01", "page_count": 224}
|
|
|
|
{"index":{"_id": "The Giver"}}
|
|
|
|
{"name": "The Giver", "author": "Lois Lowry", "release_date": "1993-04-26", "page_count": 208}
|
|
|
|
{"index":{"_id": "Slaughterhouse-Five"}}
|
|
|
|
{"name": "Slaughterhouse-Five", "author": "Kurt Vonnegut", "release_date": "1969-06-01", "page_count": 275}
|
|
|
|
{"index":{"_id": "The Hitchhiker's Guide to the Galaxy"}}
|
|
|
|
{"name": "The Hitchhiker's Guide to the Galaxy", "author": "Douglas Adams", "release_date": "1979-10-12", "page_count": 180}
|
|
|
|
{"index":{"_id": "Snow Crash"}}
|
|
|
|
{"name": "Snow Crash", "author": "Neal Stephenson", "release_date": "1992-06-01", "page_count": 470}
|
|
|
|
{"index":{"_id": "Neuromancer"}}
|
|
|
|
{"name": "Neuromancer", "author": "William Gibson", "release_date": "1984-07-01", "page_count": 271}
|
|
|
|
{"index":{"_id": "The Handmaid's Tale"}}
|
|
|
|
{"name": "The Handmaid's Tale", "author": "Margaret Atwood", "release_date": "1985-06-01", "page_count": 311}
|
|
|
|
{"index":{"_id": "Starship Troopers"}}
|
|
|
|
{"name": "Starship Troopers", "author": "Robert A. Heinlein", "release_date": "1959-12-01", "page_count": 335}
|
|
|
|
{"index":{"_id": "The Left Hand of Darkness"}}
|
|
|
|
{"name": "The Left Hand of Darkness", "author": "Ursula K. Le Guin", "release_date": "1969-06-01", "page_count": 304}
|
|
|
|
{"index":{"_id": "The Moon is a Harsh Mistress"}}
|
|
|
|
{"name": "The Moon is a Harsh Mistress", "author": "Robert A. Heinlein", "release_date": "1966-04-01", "page_count": 288}
|
|
|
|
|
|
|
|
'''
|
2018-06-12 11:57:11 -04:00
|
|
|
setups['sample_job'] = '''
|
|
|
|
- do:
|
2019-02-18 06:40:07 -05:00
|
|
|
ml.put_job:
|
2018-06-12 11:57:11 -04:00
|
|
|
job_id: "sample_job"
|
|
|
|
body: >
|
|
|
|
{
|
|
|
|
"description" : "Very basic job",
|
|
|
|
"analysis_config" : {
|
|
|
|
"bucket_span":"10m",
|
|
|
|
"detectors" :[
|
|
|
|
{
|
|
|
|
"function": "count"
|
|
|
|
}
|
|
|
|
]},
|
|
|
|
"data_description" : {
|
|
|
|
"time_field":"timestamp",
|
|
|
|
"time_format": "epoch_ms"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'''
|
2018-06-06 08:21:16 -04:00
|
|
|
setups['farequote_index'] = '''
|
|
|
|
- do:
|
|
|
|
indices.create:
|
|
|
|
index: farequote
|
|
|
|
body:
|
|
|
|
settings:
|
|
|
|
number_of_shards: 1
|
|
|
|
number_of_replicas: 0
|
|
|
|
mappings:
|
|
|
|
metric:
|
|
|
|
properties:
|
|
|
|
time:
|
|
|
|
type: date
|
|
|
|
responsetime:
|
|
|
|
type: float
|
|
|
|
airline:
|
2018-06-21 14:32:11 -04:00
|
|
|
type: keyword
|
|
|
|
doc_count:
|
2018-07-24 11:53:04 -04:00
|
|
|
type: integer
|
2018-06-06 08:21:16 -04:00
|
|
|
'''
|
|
|
|
setups['farequote_data'] = setups['farequote_index'] + '''
|
|
|
|
- do:
|
|
|
|
bulk:
|
|
|
|
index: farequote
|
|
|
|
type: metric
|
|
|
|
refresh: true
|
|
|
|
body: |
|
|
|
|
{"index": {"_id":"1"}}
|
2018-06-21 14:32:11 -04:00
|
|
|
{"airline":"JZA","responsetime":990.4628,"time":"2016-02-07T00:00:00+0000", "doc_count": 5}
|
2018-06-06 08:21:16 -04:00
|
|
|
{"index": {"_id":"2"}}
|
2018-06-21 14:32:11 -04:00
|
|
|
{"airline":"JBU","responsetime":877.5927,"time":"2016-02-07T00:00:00+0000", "doc_count": 23}
|
2018-07-24 11:53:04 -04:00
|
|
|
{"index": {"_id":"3"}}
|
2018-06-21 14:32:11 -04:00
|
|
|
{"airline":"KLM","responsetime":1355.4812,"time":"2016-02-07T00:00:00+0000", "doc_count": 42}
|
2018-06-06 08:21:16 -04:00
|
|
|
'''
|
|
|
|
setups['farequote_job'] = setups['farequote_data'] + '''
|
|
|
|
- do:
|
2019-02-18 06:40:07 -05:00
|
|
|
ml.put_job:
|
2018-06-06 08:21:16 -04:00
|
|
|
job_id: "farequote"
|
|
|
|
body: >
|
|
|
|
{
|
|
|
|
"analysis_config": {
|
|
|
|
"bucket_span": "60m",
|
|
|
|
"detectors": [{
|
|
|
|
"function": "mean",
|
|
|
|
"field_name": "responsetime",
|
|
|
|
"by_field_name": "airline"
|
|
|
|
}],
|
|
|
|
"summary_count_field_name": "doc_count"
|
|
|
|
},
|
|
|
|
"data_description": {
|
|
|
|
"time_field": "time"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'''
|
2018-06-21 14:32:11 -04:00
|
|
|
setups['farequote_datafeed'] = setups['farequote_job'] + '''
|
|
|
|
- do:
|
2019-02-18 06:40:07 -05:00
|
|
|
ml.put_datafeed:
|
2018-06-21 14:32:11 -04:00
|
|
|
datafeed_id: "datafeed-farequote"
|
|
|
|
body: >
|
|
|
|
{
|
|
|
|
"job_id":"farequote",
|
|
|
|
"indexes":"farequote"
|
|
|
|
}
|
2018-08-21 20:03:28 -04:00
|
|
|
'''
|
2018-07-25 11:10:32 -04:00
|
|
|
setups['ml_filter_safe_domains'] = '''
|
|
|
|
- do:
|
2019-02-18 06:40:07 -05:00
|
|
|
ml.put_filter:
|
2018-07-25 11:10:32 -04:00
|
|
|
filter_id: "safe_domains"
|
|
|
|
body: >
|
|
|
|
{
|
|
|
|
"description": "A list of safe domains",
|
|
|
|
"items": ["*.google.com", "wikipedia.org"]
|
|
|
|
}
|
2018-07-24 11:53:04 -04:00
|
|
|
'''
|
2017-10-30 10:54:33 -04:00
|
|
|
setups['server_metrics_index'] = '''
|
|
|
|
- do:
|
|
|
|
indices.create:
|
|
|
|
index: server-metrics
|
|
|
|
body:
|
|
|
|
settings:
|
|
|
|
number_of_shards: 1
|
|
|
|
number_of_replicas: 0
|
|
|
|
mappings:
|
|
|
|
metric:
|
|
|
|
properties:
|
|
|
|
timestamp:
|
|
|
|
type: date
|
|
|
|
total:
|
|
|
|
type: long
|
|
|
|
'''
|
2018-02-20 14:08:37 -05:00
|
|
|
setups['server_metrics_data'] = setups['server_metrics_index'] + '''
|
|
|
|
- do:
|
|
|
|
bulk:
|
|
|
|
index: server-metrics
|
|
|
|
type: metric
|
|
|
|
refresh: true
|
|
|
|
body: |
|
|
|
|
{"index": {"_id":"1177"}}
|
|
|
|
{"timestamp":"2017-03-23T13:00:00","total":40476}
|
|
|
|
{"index": {"_id":"1178"}}
|
|
|
|
{"timestamp":"2017-03-23T13:00:00","total":15287}
|
|
|
|
{"index": {"_id":"1179"}}
|
|
|
|
{"timestamp":"2017-03-23T13:00:00","total":-776}
|
|
|
|
{"index": {"_id":"1180"}}
|
|
|
|
{"timestamp":"2017-03-23T13:00:00","total":11366}
|
|
|
|
{"index": {"_id":"1181"}}
|
|
|
|
{"timestamp":"2017-03-23T13:00:00","total":3606}
|
|
|
|
{"index": {"_id":"1182"}}
|
|
|
|
{"timestamp":"2017-03-23T13:00:00","total":19006}
|
|
|
|
{"index": {"_id":"1183"}}
|
|
|
|
{"timestamp":"2017-03-23T13:00:00","total":38613}
|
|
|
|
{"index": {"_id":"1184"}}
|
|
|
|
{"timestamp":"2017-03-23T13:00:00","total":19516}
|
|
|
|
{"index": {"_id":"1185"}}
|
|
|
|
{"timestamp":"2017-03-23T13:00:00","total":-258}
|
|
|
|
{"index": {"_id":"1186"}}
|
|
|
|
{"timestamp":"2017-03-23T13:00:00","total":9551}
|
|
|
|
{"index": {"_id":"1187"}}
|
|
|
|
{"timestamp":"2017-03-23T13:00:00","total":11217}
|
|
|
|
{"index": {"_id":"1188"}}
|
|
|
|
{"timestamp":"2017-03-23T13:00:00","total":22557}
|
|
|
|
{"index": {"_id":"1189"}}
|
|
|
|
{"timestamp":"2017-03-23T13:00:00","total":40508}
|
|
|
|
{"index": {"_id":"1190"}}
|
|
|
|
{"timestamp":"2017-03-23T13:00:00","total":11887}
|
|
|
|
{"index": {"_id":"1191"}}
|
|
|
|
{"timestamp":"2017-03-23T13:00:00","total":31659}
|
|
|
|
'''
|
|
|
|
setups['server_metrics_job'] = setups['server_metrics_data'] + '''
|
2017-10-30 10:54:33 -04:00
|
|
|
- do:
|
2019-02-18 06:40:07 -05:00
|
|
|
ml.put_job:
|
2017-10-30 10:54:33 -04:00
|
|
|
job_id: "total-requests"
|
|
|
|
body: >
|
|
|
|
{
|
|
|
|
"description" : "Total sum of requests",
|
|
|
|
"analysis_config" : {
|
|
|
|
"bucket_span":"10m",
|
|
|
|
"detectors" :[
|
|
|
|
{
|
|
|
|
"detector_description": "Sum of total",
|
|
|
|
"function": "sum",
|
|
|
|
"field_name": "total"
|
|
|
|
}
|
|
|
|
]},
|
|
|
|
"data_description" : {
|
|
|
|
"time_field":"timestamp",
|
|
|
|
"time_format": "epoch_ms"
|
|
|
|
}
|
|
|
|
}
|
2017-10-30 13:23:27 -04:00
|
|
|
'''
|
2018-02-09 12:16:24 -05:00
|
|
|
setups['server_metrics_datafeed'] = setups['server_metrics_job'] + '''
|
2017-11-27 13:57:37 -05:00
|
|
|
- do:
|
2019-02-18 06:40:07 -05:00
|
|
|
ml.put_datafeed:
|
2017-11-27 13:57:37 -05:00
|
|
|
datafeed_id: "datafeed-total-requests"
|
|
|
|
body: >
|
|
|
|
{
|
|
|
|
"job_id":"total-requests",
|
2018-03-07 16:53:49 -05:00
|
|
|
"indexes":"server-metrics"
|
2017-11-27 13:57:37 -05:00
|
|
|
}
|
2018-02-09 12:16:24 -05:00
|
|
|
'''
|
|
|
|
setups['server_metrics_openjob'] = setups['server_metrics_datafeed'] + '''
|
2017-11-27 13:57:37 -05:00
|
|
|
- do:
|
2019-02-18 06:40:07 -05:00
|
|
|
ml.open_job:
|
2017-11-27 13:57:37 -05:00
|
|
|
job_id: "total-requests"
|
|
|
|
'''
|
2018-01-25 12:33:21 -05:00
|
|
|
setups['server_metrics_startdf'] = setups['server_metrics_openjob'] + '''
|
2017-11-27 13:15:46 -05:00
|
|
|
- do:
|
2019-02-18 06:40:07 -05:00
|
|
|
ml.start_datafeed:
|
2017-11-27 13:15:46 -05:00
|
|
|
datafeed_id: "datafeed-total-requests"
|
2018-01-24 11:14:23 -05:00
|
|
|
'''
|
|
|
|
setups['calendar_outages'] = '''
|
|
|
|
- do:
|
2019-02-18 06:40:07 -05:00
|
|
|
ml.put_calendar:
|
2018-01-24 11:14:23 -05:00
|
|
|
calendar_id: "planned-outages"
|
|
|
|
'''
|
|
|
|
setups['calendar_outages_addevent'] = setups['calendar_outages'] + '''
|
|
|
|
- do:
|
2019-02-18 06:40:07 -05:00
|
|
|
ml.post_calendar_events:
|
2018-01-24 11:14:23 -05:00
|
|
|
calendar_id: "planned-outages"
|
|
|
|
body: >
|
|
|
|
{ "description": "event 1", "start_time": "2017-12-01T00:00:00Z", "end_time": "2017-12-02T00:00:00Z", "calendar_id": "planned-outages" }
|
|
|
|
|
2017-11-27 13:15:46 -05:00
|
|
|
|
|
|
|
'''
|
2018-01-24 11:14:23 -05:00
|
|
|
setups['calendar_outages_openjob'] = setups['server_metrics_openjob'] + '''
|
|
|
|
- do:
|
2019-02-18 06:40:07 -05:00
|
|
|
ml.put_calendar:
|
2018-01-24 11:14:23 -05:00
|
|
|
calendar_id: "planned-outages"
|
|
|
|
'''
|
|
|
|
setups['calendar_outages_addjob'] = setups['server_metrics_openjob'] + '''
|
|
|
|
- do:
|
2019-02-18 06:40:07 -05:00
|
|
|
ml.put_calendar:
|
2018-01-24 11:14:23 -05:00
|
|
|
calendar_id: "planned-outages"
|
|
|
|
body: >
|
|
|
|
{
|
|
|
|
"job_ids": ["total-requests"]
|
|
|
|
}
|
|
|
|
'''
|
|
|
|
setups['calendar_outages_addevent'] = setups['calendar_outages_addjob'] + '''
|
|
|
|
- do:
|
2019-02-18 06:40:07 -05:00
|
|
|
ml.post_calendar_events:
|
2018-01-24 11:14:23 -05:00
|
|
|
calendar_id: "planned-outages"
|
|
|
|
body: >
|
|
|
|
{ "events" : [
|
|
|
|
{ "description": "event 1", "start_time": "1513641600000", "end_time": "1513728000000"},
|
|
|
|
{ "description": "event 2", "start_time": "1513814400000", "end_time": "1513900800000"},
|
|
|
|
{ "description": "event 3", "start_time": "1514160000000", "end_time": "1514246400000"}
|
|
|
|
]}
|
|
|
|
'''
|
2018-02-16 12:29:19 -05:00
|
|
|
setups['role_mapping'] = '''
|
|
|
|
- do:
|
2018-12-11 04:13:10 -05:00
|
|
|
security.put_role_mapping:
|
2018-02-16 12:29:19 -05:00
|
|
|
name: "mapping1"
|
|
|
|
body: >
|
|
|
|
{
|
|
|
|
"enabled": true,
|
|
|
|
"roles": [ "user" ],
|
|
|
|
"rules": { "field": { "username": "*" } }
|
|
|
|
}
|
|
|
|
'''
|
2018-02-23 17:10:37 -05:00
|
|
|
setups['sensor_rollup_job'] = '''
|
|
|
|
- do:
|
|
|
|
indices.create:
|
|
|
|
index: sensor-1
|
|
|
|
body:
|
|
|
|
settings:
|
|
|
|
number_of_shards: 1
|
|
|
|
number_of_replicas: 0
|
|
|
|
mappings:
|
2019-02-05 13:52:32 -05:00
|
|
|
properties:
|
|
|
|
timestamp:
|
|
|
|
type: date
|
|
|
|
temperature:
|
|
|
|
type: long
|
|
|
|
voltage:
|
|
|
|
type: float
|
|
|
|
node:
|
|
|
|
type: keyword
|
2018-02-23 17:10:37 -05:00
|
|
|
- do:
|
2019-02-18 06:40:07 -05:00
|
|
|
rollup.put_job:
|
2018-02-23 17:10:37 -05:00
|
|
|
id: "sensor"
|
|
|
|
body: >
|
|
|
|
{
|
|
|
|
"index_pattern": "sensor-*",
|
|
|
|
"rollup_index": "sensor_rollup",
|
|
|
|
"cron": "*/30 * * * * ?",
|
2018-04-10 16:34:40 -04:00
|
|
|
"page_size" :1000,
|
2018-02-23 17:10:37 -05:00
|
|
|
"groups" : {
|
|
|
|
"date_histogram": {
|
|
|
|
"field": "timestamp",
|
|
|
|
"interval": "1h",
|
|
|
|
"delay": "7d"
|
|
|
|
},
|
|
|
|
"terms": {
|
|
|
|
"fields": ["node"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"metrics": [
|
|
|
|
{
|
|
|
|
"field": "temperature",
|
|
|
|
"metrics": ["min", "max", "sum"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"field": "voltage",
|
|
|
|
"metrics": ["avg"]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
'''
|
|
|
|
setups['sensor_started_rollup_job'] = '''
|
|
|
|
- do:
|
|
|
|
indices.create:
|
|
|
|
index: sensor-1
|
|
|
|
body:
|
|
|
|
settings:
|
|
|
|
number_of_shards: 1
|
|
|
|
number_of_replicas: 0
|
|
|
|
mappings:
|
2019-02-05 13:52:32 -05:00
|
|
|
properties:
|
|
|
|
timestamp:
|
|
|
|
type: date
|
|
|
|
temperature:
|
|
|
|
type: long
|
|
|
|
voltage:
|
|
|
|
type: float
|
|
|
|
node:
|
|
|
|
type: keyword
|
2018-03-07 16:53:49 -05:00
|
|
|
|
2018-02-23 17:10:37 -05:00
|
|
|
- do:
|
|
|
|
bulk:
|
|
|
|
index: sensor-1
|
|
|
|
refresh: true
|
|
|
|
body: |
|
|
|
|
{"index":{}}
|
|
|
|
{"timestamp": 1516729294000, "temperature": 200, "voltage": 5.2, "node": "a"}
|
|
|
|
{"index":{}}
|
|
|
|
{"timestamp": 1516642894000, "temperature": 201, "voltage": 5.8, "node": "b"}
|
|
|
|
{"index":{}}
|
|
|
|
{"timestamp": 1516556494000, "temperature": 202, "voltage": 5.1, "node": "a"}
|
|
|
|
{"index":{}}
|
|
|
|
{"timestamp": 1516470094000, "temperature": 198, "voltage": 5.6, "node": "b"}
|
|
|
|
{"index":{}}
|
|
|
|
{"timestamp": 1516383694000, "temperature": 200, "voltage": 4.2, "node": "c"}
|
|
|
|
{"index":{}}
|
|
|
|
{"timestamp": 1516297294000, "temperature": 202, "voltage": 4.0, "node": "c"}
|
|
|
|
|
|
|
|
- do:
|
2019-02-18 06:40:07 -05:00
|
|
|
rollup.put_job:
|
2018-02-23 17:10:37 -05:00
|
|
|
id: "sensor"
|
|
|
|
body: >
|
|
|
|
{
|
|
|
|
"index_pattern": "sensor-*",
|
|
|
|
"rollup_index": "sensor_rollup",
|
|
|
|
"cron": "* * * * * ?",
|
2018-04-10 16:34:40 -04:00
|
|
|
"page_size" :1000,
|
2018-02-23 17:10:37 -05:00
|
|
|
"groups" : {
|
|
|
|
"date_histogram": {
|
|
|
|
"field": "timestamp",
|
|
|
|
"interval": "1h",
|
|
|
|
"delay": "7d"
|
|
|
|
},
|
|
|
|
"terms": {
|
|
|
|
"fields": ["node"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"metrics": [
|
|
|
|
{
|
|
|
|
"field": "temperature",
|
|
|
|
"metrics": ["min", "max", "sum"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"field": "voltage",
|
|
|
|
"metrics": ["avg"]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
- do:
|
2019-02-18 06:40:07 -05:00
|
|
|
rollup.start_job:
|
2018-02-23 17:10:37 -05:00
|
|
|
id: "sensor"
|
|
|
|
'''
|
|
|
|
|
|
|
|
setups['sensor_index'] = '''
|
|
|
|
- do:
|
|
|
|
indices.create:
|
|
|
|
index: sensor-1
|
|
|
|
body:
|
|
|
|
settings:
|
|
|
|
number_of_shards: 1
|
|
|
|
number_of_replicas: 0
|
|
|
|
mappings:
|
2019-02-05 13:52:32 -05:00
|
|
|
properties:
|
|
|
|
timestamp:
|
|
|
|
type: date
|
|
|
|
temperature:
|
|
|
|
type: long
|
|
|
|
voltage:
|
|
|
|
type: float
|
|
|
|
node:
|
|
|
|
type: keyword
|
|
|
|
load:
|
|
|
|
type: double
|
|
|
|
net_in:
|
|
|
|
type: long
|
|
|
|
net_out:
|
|
|
|
type: long
|
|
|
|
hostname:
|
|
|
|
type: keyword
|
|
|
|
datacenter:
|
|
|
|
type: keyword
|
2018-02-23 17:10:37 -05:00
|
|
|
'''
|
|
|
|
|
|
|
|
setups['sensor_prefab_data'] = '''
|
2018-04-04 18:32:26 -04:00
|
|
|
- do:
|
|
|
|
indices.create:
|
|
|
|
index: sensor-1
|
|
|
|
body:
|
|
|
|
settings:
|
|
|
|
number_of_shards: 1
|
|
|
|
number_of_replicas: 0
|
|
|
|
mappings:
|
2019-02-05 13:52:32 -05:00
|
|
|
properties:
|
|
|
|
timestamp:
|
|
|
|
type: date
|
|
|
|
temperature:
|
|
|
|
type: long
|
|
|
|
voltage:
|
|
|
|
type: float
|
|
|
|
node:
|
|
|
|
type: keyword
|
2018-02-23 17:10:37 -05:00
|
|
|
- do:
|
|
|
|
indices.create:
|
|
|
|
index: sensor_rollup
|
|
|
|
body:
|
|
|
|
settings:
|
|
|
|
number_of_shards: 1
|
|
|
|
number_of_replicas: 0
|
|
|
|
mappings:
|
2019-02-05 13:52:32 -05:00
|
|
|
properties:
|
|
|
|
node.terms.value:
|
|
|
|
type: keyword
|
|
|
|
temperature.sum.value:
|
|
|
|
type: double
|
|
|
|
temperature.max.value:
|
|
|
|
type: double
|
|
|
|
temperature.min.value:
|
|
|
|
type: double
|
|
|
|
timestamp.date_histogram.time_zone:
|
|
|
|
type: keyword
|
|
|
|
timestamp.date_histogram.interval:
|
|
|
|
type: keyword
|
|
|
|
timestamp.date_histogram.timestamp:
|
|
|
|
type: date
|
|
|
|
timestamp.date_histogram._count:
|
|
|
|
type: long
|
|
|
|
voltage.avg.value:
|
|
|
|
type: double
|
|
|
|
voltage.avg._count:
|
|
|
|
type: long
|
|
|
|
_rollup.id:
|
|
|
|
type: keyword
|
|
|
|
_rollup.version:
|
|
|
|
type: long
|
|
|
|
_meta:
|
|
|
|
_rollup:
|
|
|
|
sensor:
|
|
|
|
cron: "* * * * * ?"
|
|
|
|
rollup_index: "sensor_rollup"
|
|
|
|
index_pattern: "sensor-*"
|
|
|
|
timeout: "20s"
|
|
|
|
page_size: 1000
|
|
|
|
groups:
|
|
|
|
date_histogram:
|
|
|
|
field: "timestamp"
|
|
|
|
interval: "7d"
|
|
|
|
time_zone: "UTC"
|
|
|
|
terms:
|
|
|
|
fields:
|
|
|
|
- "node"
|
|
|
|
id: sensor
|
|
|
|
metrics:
|
|
|
|
- field: "temperature"
|
|
|
|
metrics:
|
|
|
|
- min
|
|
|
|
- max
|
|
|
|
- sum
|
|
|
|
- field: "voltage"
|
|
|
|
metrics:
|
|
|
|
- avg
|
2018-02-23 17:10:37 -05:00
|
|
|
|
|
|
|
- do:
|
|
|
|
bulk:
|
|
|
|
index: sensor_rollup
|
|
|
|
refresh: true
|
|
|
|
body: |
|
|
|
|
{"index":{}}
|
|
|
|
{"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"}
|
|
|
|
{"index":{}}
|
|
|
|
{"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"}
|
|
|
|
{"index":{}}
|
|
|
|
{"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"}
|
|
|
|
{"index":{}}
|
|
|
|
{"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"}
|
|
|
|
{"index":{}}
|
|
|
|
{"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"}
|
|
|
|
{"index":{}}
|
|
|
|
{"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"}
|
2018-03-07 16:53:49 -05:00
|
|
|
|
2018-02-23 17:10:37 -05:00
|
|
|
'''
|
2018-08-17 12:18:08 -04:00
|
|
|
setups['admin_role'] = '''
|
|
|
|
- do:
|
2018-12-11 04:13:10 -05:00
|
|
|
security.put_role:
|
2018-08-17 12:18:08 -04:00
|
|
|
name: "my_admin_role"
|
|
|
|
body: >
|
|
|
|
{
|
|
|
|
"cluster": ["all"],
|
|
|
|
"indices": [
|
|
|
|
{"names": ["index1", "index2" ], "privileges": ["all"], "field_security" : {"grant" : [ "title", "body" ]}}
|
|
|
|
],
|
|
|
|
"run_as": [ "other_user" ],
|
|
|
|
"metadata" : {"version": 1}
|
|
|
|
}
|
|
|
|
'''
|
2018-08-18 02:17:33 -04:00
|
|
|
setups['jacknich_user'] = '''
|
|
|
|
- do:
|
2018-12-11 04:13:10 -05:00
|
|
|
security.put_user:
|
2018-08-18 02:17:33 -04:00
|
|
|
username: "jacknich"
|
|
|
|
body: >
|
|
|
|
{
|
|
|
|
"password" : "test-password",
|
|
|
|
"roles" : [ "admin", "other_role1" ],
|
|
|
|
"full_name" : "Jack Nicholson",
|
|
|
|
"email" : "jacknich@example.com",
|
|
|
|
"metadata" : { "intelligence" : 7 }
|
|
|
|
}
|
|
|
|
'''
|
2018-08-23 21:04:02 -04:00
|
|
|
setups['app0102_privileges'] = '''
|
|
|
|
- do:
|
2018-12-11 04:13:10 -05:00
|
|
|
security.put_privileges:
|
2018-08-23 21:04:02 -04:00
|
|
|
body: >
|
|
|
|
{
|
|
|
|
"myapp": {
|
|
|
|
"read": {
|
|
|
|
"application": "myapp",
|
|
|
|
"name": "read",
|
|
|
|
"actions": [
|
|
|
|
"data:read/*",
|
|
|
|
"action:login" ],
|
|
|
|
"metadata": {
|
|
|
|
"description": "Read access to myapp"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'''
|