diff --git a/build.gradle b/build.gradle index e139bb82625..b64e9b8182d 100644 --- a/build.gradle +++ b/build.gradle @@ -50,6 +50,7 @@ subprojects { additionalLicense 'ESCON', 'Elasticsearch Confidential', 'ELASTICSEARCH CONFIDENTIAL' } ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-api:${version}": ':x-pack-elasticsearch:plugin'] + ext.projectSubstitutions += [ "org.elasticsearch:x-pack-client-api-objects:${version}": ':x-pack-elasticsearch:client:client-api-objects'] if (wireCompatVersions[-1].snapshot) { /* The last and second to last versions can be snapshots. Rather than use diff --git a/client/build.gradle b/client/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/client/client-api-objects/README.md b/client/client-api-objects/README.md new file mode 100644 index 00000000000..1486c5ab030 --- /dev/null +++ b/client/client-api-objects/README.md @@ -0,0 +1,4 @@ +# Client API objects + +This is a common dependency of the `xpack` and `transport-client` projects so +they can share the same `Request` and `Response` objects. diff --git a/client/client-api-objects/build.gradle b/client/client-api-objects/build.gradle new file mode 100644 index 00000000000..2b5e0164c1b --- /dev/null +++ b/client/client-api-objects/build.gradle @@ -0,0 +1,10 @@ +apply plugin: 'elasticsearch.build' + +dependencies { + provided "org.elasticsearch:elasticsearch:${version}" +} + +archivesBaseName = 'x-pack-client-api-objects' + +// TODO: enable this once we have tests +test.enabled=false diff --git a/plugin/src/main/java/org/elasticsearch/license/GetLicenseRequest.java b/client/client-api-objects/src/main/java/org/elasticsearch/license/GetLicenseRequest.java similarity index 100% rename from plugin/src/main/java/org/elasticsearch/license/GetLicenseRequest.java rename to client/client-api-objects/src/main/java/org/elasticsearch/license/GetLicenseRequest.java diff --git a/docs/build.gradle b/docs/build.gradle index d5dcb93ce1f..11a0ed7818b 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -97,6 +97,7 @@ buildRestTests.expectedUnconvertedCandidates = [ dependencies { testCompile project(path: ':x-pack-elasticsearch:plugin', configuration: 'runtime') + testCompile project(path: ':x-pack-elasticsearch:plugin', configuration: 'testArtifacts') } Closure waitWithAuth = { NodeInfo node, AntBuilder ant -> diff --git a/docs/en/ml/index.asciidoc b/docs/en/ml/index.asciidoc index 07e2e42873c..3f6c4f1ba7f 100644 --- a/docs/en/ml/index.asciidoc +++ b/docs/en/ml/index.asciidoc @@ -30,6 +30,7 @@ from {es} for analysis and anomaly results are displayed in {kib} dashboards. include::overview.asciidoc[] include::getting-started.asciidoc[] include::configuring.asciidoc[] +include::stopping-ml.asciidoc[] // include::ml-scenarios.asciidoc[] include::api-quickref.asciidoc[] //include::troubleshooting.asciidoc[] Referenced from x-pack/docs/public/xpack-troubleshooting.asciidoc diff --git a/docs/en/ml/stopping-ml.asciidoc b/docs/en/ml/stopping-ml.asciidoc new file mode 100644 index 00000000000..862fe5cf050 --- /dev/null +++ b/docs/en/ml/stopping-ml.asciidoc @@ -0,0 +1,87 @@ +[[stopping-ml]] +== Stopping Machine Learning + +An orderly shutdown of {ml} ensures that: + +* {dfeeds-cap} are stopped +* Buffers are flushed +* Model history is pruned +* Final results are calculated +* Model snapshots are saved +* Jobs are closed + +This process ensures that jobs are in a consistent state in case you want to +subsequently re-open them. + +[float] +[[stopping-ml-datafeeds]] +=== Stopping {dfeeds-cap} + +When you stop a {dfeed}, it ceases to retrieve data from {es}. You can stop a +{dfeed} by using {kib} or the +{ref}/ml-stop-datafeed.html[stop {dfeeds} API]. For example, the following +request stops the `feed1` {dfeed}: + +[source,js] +-------------------------------------------------- +POST _xpack/ml/datafeeds/feed1/_stop +-------------------------------------------------- +// CONSOLE +// TEST[skip:todo] + +NOTE: You must have `manage_ml`, or `manage` cluster privileges to stop {dfeeds}. +For more information, see <>. + +A {dfeed} can be started and stopped multiple times throughout its lifecycle. + +For examples of stopping {dfeeds} in {kib}, see <>. + +[float] +[[stopping-all-ml-datafeeds]] +==== Stopping All {dfeeds-cap} + +If you are upgrading your cluster, you can use the following request to stop all +{dfeeds}: + +[source,js] +---------------------------------- +POST _xpack/ml/datafeeds/_all/_stop +---------------------------------- +// CONSOLE + +[float] +[[closing-ml-jobs]] +=== Closing Jobs + +When you close a job, it cannot receive data or perform analysis operations. +If a job is associated with a {dfeed}, you must stop the {dfeed} before you can +close the jobs. If the {dfeed} has an end date, the job closes automatically on +that end date. + +You can close a job by using the {ref}/ml-close-job.html[close job API]. For +example, the following request closes the `job1` job: + +[source,js] +-------------------------------------------------- +POST _xpack/ml/anomaly_detectors/job1/_close +-------------------------------------------------- +// CONSOLE +// TEST[skip:todo] + +NOTE: You must have `manage_ml`, or `manage` cluster privileges to stop {dfeeds}. +For more information, see <>. + +A job can be opened and closed multiple times throughout its lifecycle. + +[float] +[[closing-all-ml-datafeeds]] +==== Closing All Jobs + +If you are upgrading your cluster, you can use the following request to close +all open jobs on the cluster: + +[source,js] +---------------------------------- +POST _xpack/ml/anomaly_detectors/_all/_close +---------------------------------- +// CONSOLE diff --git a/docs/en/setup/images/ElasticsearchFlow.jpg b/docs/en/setup/images/ElasticsearchFlow.jpg new file mode 100644 index 00000000000..41fd8508c7a Binary files /dev/null and b/docs/en/setup/images/ElasticsearchFlow.jpg differ diff --git a/docs/en/setup/installing-xes.asciidoc b/docs/en/setup/installing-xes.asciidoc index 4db4788cb09..b397ce29bf0 100644 --- a/docs/en/setup/installing-xes.asciidoc +++ b/docs/en/setup/installing-xes.asciidoc @@ -12,7 +12,7 @@ see https://www.elastic.co/products/x-pack. You must run the version of {xpack} that matches the version of {es} you are running. See the https://www.elastic.co/support/matrix#matrix_compatibility[Elastic Support Matrix] -for more information about product compatibility. +for more information about product compatibility. IMPORTANT: If you are installing {xpack} for the first time on an existing cluster, you must perform a full cluster restart. Installing {xpack} enables @@ -20,6 +20,11 @@ security and security must be enabled on ALL nodes in a cluster for the cluster to operate correctly. When upgrading you can usually perform a {ref}/rolling-upgrades.html[rolling upgrade]. +The following diagram provides an overview of the steps that are required to +set up {xpack} on {es}: + +image::setup/images/ElasticsearchFlow.jpg[Installation overview on {es}] + To install {xpack} in {es}: . Optional: If you want to install {xpack} on a machine that doesn't have diff --git a/docs/src/test/java/org/elasticsearch/smoketest/XDocsClientYamlTestSuiteIT.java b/docs/src/test/java/org/elasticsearch/smoketest/XDocsClientYamlTestSuiteIT.java index 1df2639eca4..0adff1f9e27 100644 --- a/docs/src/test/java/org/elasticsearch/smoketest/XDocsClientYamlTestSuiteIT.java +++ b/docs/src/test/java/org/elasticsearch/smoketest/XDocsClientYamlTestSuiteIT.java @@ -19,6 +19,7 @@ import org.elasticsearch.test.rest.yaml.ClientYamlTestClient; import org.elasticsearch.test.rest.yaml.ClientYamlTestResponse; import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase; import org.elasticsearch.test.rest.yaml.restspec.ClientYamlSuiteRestSpec; +import org.elasticsearch.xpack.ml.integration.MlRestTestStateCleaner; import org.junit.After; import java.io.IOException; @@ -116,4 +117,9 @@ public class XDocsClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase { } } } + + @After + public void cleanMlState() { + new MlRestTestStateCleaner(logger, adminClient(), this); + } } diff --git a/plugin/build.gradle b/plugin/build.gradle index 04f5d945a25..640f2d7e5c1 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -39,6 +39,7 @@ dependencyLicenses { mapping from: /http.*/, to: 'httpclient' // pulled in by rest client mapping from: /commons-.*/, to: 'commons' // pulled in by rest client ignoreSha 'elasticsearch-rest-client' + ignoreSha 'x-pack-client-api-objects' ignoreSha 'transport-netty4' ignoreSha 'tribe' ignoreSha 'server' @@ -67,6 +68,9 @@ configurations { } dependencies { + // Request and Response objects + compile "org.elasticsearch:x-pack-client-api-objects:${version}" + // security deps compile project(path: ':modules:transport-netty4', configuration: 'runtime') compile 'com.unboundid:unboundid-ldapsdk:3.2.0' diff --git a/plugin/licenses/x-pack-client-api-objects-LICENSE.txt b/plugin/licenses/x-pack-client-api-objects-LICENSE.txt new file mode 100644 index 00000000000..9202eab5b2f --- /dev/null +++ b/plugin/licenses/x-pack-client-api-objects-LICENSE.txt @@ -0,0 +1,120 @@ +COMMERCIAL SOFTWARE END USER LICENSE AGREEMENT + + READ THIS COMMERCIAL SOFTWARE END USER LICENSE AGREEMENT CAREFULLY, WHICH CONSTITUTES A LEGALLY BINDING AGREEMENT AND GOVERNS YOUR USE OF ELASTIC’S PROPRIETARY SOFTWARE. BY INSTALLING AND/OR USING SUCH SOFTWARE, YOU ARE INDICATING THAT YOU AGREE TO THE TERMS AND CONDITIONS SET FORTH IN THIS AGREEMENT. IF YOU DO NOT AGREE WITH SUCH TERMS AND CONDITIONS, YOU MAY NOT INSTALL OR USE ANY OF THE SOFTWARE. IF YOU ARE INSTALLING OR USING THE SOFTWARE ON BEHALF OF YOUR EMPLOYER OR ANOTHER ENTITY, YOU REPRESENT AND WARRANT THAT YOU HAVE THE ACTUAL AUTHORITY TO AGREE TO THE TERMS AND CONDITIONS ON BEHALF OF SUCH EMPLOYER OR OTHER ENTITY. + + This COMMERCIAL SOFTWARE END USER LICENSE AGREEMENT (this “Agreement") is entered into by and between the applicable Elastic entity referenced in Attachment 1 hereto (“Elastic”) and the person, or entity on behalf of whom you are acting, as applicable (“You” or “Customer”) that has downloaded any of Elastic’s proprietary software to which this Agreement is attached or in connection with which this Agreement is presented to You (collectively, the “Software”). This Agreement is effective upon the earliest date of the commencement of any License granted pursuant to Section 1.1. below (as applicable, the “Effective Date”). + +1. SOFTWARE LICENSE AND RESTRICTIONS +1.1 License Grants. +(a) Trial Version License. Subject to the terms and conditions of this Agreement, Elastic agrees to grant, and does hereby grant to You, for a period of thirty (30) days from the date on which You first install the Software (the “Trial Term”), a License to use the Eligible Features and Functions of the Software that are applicable to the Trial Version of the Software.   You understand and agree that upon the expiration of a Trial Term, You will no longer be able to use the Software, unless you either (i) purchase a Subscription, in which case You will receive a License under Section 1.1(b) below to use the Eligible Features and Functions of the Software that are applicable to the Subscription level that You purchase, (ii) complete the Registration of Your use of the Software with Elastic, in which case, if available, You will receive a License under Section 1.1(c) below to the Basic Version of the Software or (iii) obtain from Elastic written consent (e-mail sufficient) to extend the Trial Term, which may be granted by Elastic in its sole and absolute discretion. +(b) Subscription License. If you enter into a Subscription Agreement with Elastic, then, subject to the terms and conditions of this Agreement and complete payment of any and all applicable Subscription fees, Elastic agrees to grant, and does hereby grant to You during the applicable Subscription Term, and for the restricted scope of this Agreement, a License to use the Eligible Features and Functions of the Software that are applicable to the Subscription level that You have purchased, for the number of Nodes and for the specific Project for which you have purchased a Subscription. The level of Subscription, the number of Nodes and specific Project for which you have purchased such Subscription, are set forth on the applicable ordering document entered into by Elastic and You for the purchase of the applicable Subscription (“Order Form”). +(c) Basic Version License. Subject to the terms and conditions of this Agreement, the availability of such a License for the applicable Software and any applicable limitation on the number of Nodes, and in consideration of the Registration of Your use the Software, Elastic agrees to grant, and does hereby grant to You, for a period of one (1) year from the date of Registration, a License to use the Eligible Features and Functions of the Software that are applicable to the Basic Version of the Software. The foregoing license may be renewed annually upon the mutual agreement of the parties. +1.2 Reservation of Rights; Restrictions. As between Elastic and You, Elastic owns all right title and interest in and to the Software and any derivative works thereof, and except as expressly set forth in Section 1.1 above, no other license to the Software is granted to You by implication, estoppel or otherwise. You agree not to: (i) reverse engineer or decompile, decrypt, disassemble or otherwise reduce any Software or any portion thereof to human-readable form, except and only to the extent any such restriction is prohibited by applicable law, (ii) deploy the Software on more Nodes than are permitted under the applicable License grant in Section 1.1 above, (iii) where You have purchased a Subscription, use the Software in connection with any Project other than the Project for which You have purchased such Subscription, as identified on the applicable Order Form, (iv) prepare derivative works from, modify, copy or use the Software in any manner except as expressly permitted in this Agreement; (v) except as expressly permitted in Section 1.1 above, transfer, sell, rent, lease, distribute, sublicense, loan or otherwise transfer the Software in whole or in part to any third party; (vi) except as may be expressly permitted on an applicable Order Form or in another agreement between the parties, use the Software for providing time-sharing services, any software-as-a-service offering (“SaaS”), service bureau services or as part of an application services provider or other service offering; (vii) circumvent the limitations on use of the Software that are imposed or preserved by any License Key, (viii) alter or remove any Marks and Notices in the Software; (ix) deploy the Commercial Software on or in connection with any third party infrastructure as a service that includes any Elastic-branded software as a service; or (x) make available to any third party any analysis of the results of operation of the Software, including benchmarking results, without the prior written consent of Elastic. The Software may contain or be provided with open source libraries, components, utilities and other open source software (collectively, “Open Source Software”), which Open Source Software may have applicable license terms as identified on a website designated by Elastic or otherwise provided with the Software or Documentation. Notwithstanding anything to the contrary herein, use of the Open Source Software shall be subject to the license terms and conditions applicable to such Open Source Software, to the extent required by the applicable licensor (which terms shall not restrict the license rights granted to You hereunder, but may contain additional rights). +1.3 Audit Rights. You agree that, unless such right is waived in writing by Elastic, Elastic shall have the right, upon fifteen (15) days’ notice to You, to audit Your use of the Software for compliance with any limitations on Your use of the Software that are set forth herein. You agree to provide Elastic with the necessary access to the Software to conduct such an audit either (i) remotely, or (ii) if remote performance is not possible, at Your facilities, during normal business hours and no more than one (1) time in any twelve (12) month period. In the event any such audit reveals that You have used the Software in excess of the applicable quantitative limitations, You agree to promptly pay to Elastic an amount equal to the difference between the fees actually paid and the fees that You should have paid to remain in compliance with such quantitative limitations. This Section 1.3 shall survive for a period of two (2) years from the termination or expiration of this Agreement. +1.4 Cluster Metadata. You understand and agree that once deployed, and on a daily basis, the Software may provide metadata to Elastic about Your cluster statistics and associates that metadata with Your IP address. However, no other information is provided to Elastic by the Software, including any information about the data You process or store in connection with Your use of the Software. Instructions for disabling this feature are contained in the Software, however leaving this feature active enables Elastic to gather cluster statistics and provide an improved level of support to You. +2. TERM AND TERMINATION +2.1 Term. Unless earlier terminated under Section 2.2 below, this Agreement shall commence on the Effective Date, and shall continue in force for the term of the last to expire applicable license set forth in Section 1.1 above. +2.2 Termination. Either party may, upon written notice to the other party, terminate this Agreement for material breach by the other party automatically and without any other formality, if such party has failed to cure such material breach within thirty (30) days of receiving written notice of such material breach from the non-breaching party. Notwithstanding the foregoing, this Agreement shall automatically terminate in the event that You intentionally breach the scope of a license granted in Section 1.1 of this Agreement, provided that Elastic reserves the right to retroactively waive such automatic termination upon written notice to You. +2.3 Post Termination or Expiration. Upon termination or expiration of this Agreement, for any reason, You shall promptly cease the use of the Software and Documentation and destroy (and certify to Elastic in writing the fact of such destruction), or return to Elastic, all copies of the Software and Documentation then in Your possession or under Your control. +2.4 Survival. Sections 2.3, 2.4, 3, 4, 5 and 6 (as any such Sections may be modified by Attachment 1, if applicable) shall survive any termination or expiration of this Agreement. +3. LIMITED WARRANTY AND DISCLAIMER OF WARRANTIES +3.1 Limited Performance Warranty. Subject to You purchasing a Subscription, Elastic warrants that during the applicable Subscription Term, the Software will perform in all material respects in accordance with the Documentation. In the event of a breach of the foregoing warranty, Elastic’s sole obligation, and Your exclusive remedy shall be for Elastic to (i) correct any failure(s) of the Software to perform in all material respects in accordance with the Documentation or (ii) if Elastic is unable to provide such a correction within thirty (30) days of receipt of notice of the applicable non-conformity, You may elect to terminate this Agreement and the associated Subscription, and Elastic will promptly refund to You any pre-paid, unused fees paid by You to Elastic for the applicable Subscription. The warranty set forth in this Section 3.1 does not apply if the applicable Software or any portion thereof: (a) has been altered, except by or on behalf Elastic; (b) has not been used, installed, operated, repaired, or maintained in accordance with this Agreement and/or the Documentation; (c) has been subjected to abnormal physical or electrical stress, misuse, negligence, or accident; or (d) is used on equipment, products, or systems not meeting specifications identified by Elastic in the Documentation. Additionally, the warranties set forth herein only apply when notice of a warranty claim is provided to Elastic within the applicable warranty period specified herein and do not apply to any bug, defect or error caused by or attributable to software or hardware not supplied by Elastic. +3.2 Malicious Code. Elastic represents and warrants that prior to making it available for delivery to You, Elastic will use standard industry practices including, without limitation, the use of an updated commercial anti-virus program, to test the Software for Malicious Code and remove any Malicious Code it discovers. In the event of a breach of the foregoing warranty, Elastic’s sole obligation, and Your exclusive remedy shall be for Elastic to replace the Software with Software that does not contain any Malicious Code. +3.3 Warranty Disclaimer. EXCEPT AS EXPRESSLY SET FORTH IN THIS SECTION 3, TO THE MAXIMUM EXTENT PERMITTED UNDER APPLICABLE LAW, THE SOFTWARE IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, AND ELASTIC AND ITS LICENSORS MAKE NO WARRANTIES WHETHER EXPRESSED, IMPLIED OR STATUTORY REGARDING OR RELATING TO THE SOFTWARE OR DOCUMENTATION. TO THE MAXIMUM EXTENT PERMITTED UNDER APPLICABLE LAW, ELASTIC AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT WITH RESPECT TO THE SOFTWARE AND DOCUMENTATION, AND WITH RESPECT TO THE USE OF THE FOREGOING. FURTHER, ELASTIC DOES NOT WARRANT RESULTS OF USE OR THAT THE SOFTWARE WILL BE ERROR FREE OR THAT THE USE OF THE SOFTWARE WILL BE UNINTERRUPTED. +4. LIMITATION OF LIABILITY +The provisions of this Section 4, including to the extent modified by an applicable provision in Attachment 1 hereto, apply if You have not purchased a Subscription. If you have purchased a Subscription, then the limitations of liability set forth in the applicable Subscription Agreement will apply in lieu of those set forth in this Section 4, including to the extent modified by an applicable provision in Attachment 1 hereto. +4.1 Disclaimer of Certain Damages. IN NO EVENT SHALL YOU OR ELASTIC OR ITS LICENSORS BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF USE, BUSINESS INTERRUPTION, LOSS OF DATA, COST OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND IN CONNECTION WITH OR ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE, OR THE PERFORMANCE OF OR FAILURE TO PERFORM THIS AGREEMENT, WHETHER ALLEGED AS A BREACH OF CONTRACT OR TORTIOUS CONDUCT, INCLUDING NEGLIGENCE, EVEN IF THE RESPONSIBLE PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THE LIMITATIONS OF LIABILITY SET FORTH IN THIS SECTION 4.1 SHALL NOT APPLY TO A BREACH THROUGH GROSS NEGLIGENCE OR INTENTIONAL MISCONDUCT BY YOU OF THE SCOPE OF THE LICENSE GRANTED IN SECTION 1.1 OR TO ANY OTHER LIABILITY THAT CANNOT BE EXCLUDED OR LIMITED UNDER APPLICABLE LAW. +4.2 Damages Cap. IN NO EVENT SHALL ELASTIC’S OR ITS LICENSORS’ AGGREGATE, CUMULATIVE LIABILITY UNDER THIS AGREEMENT EXCEED ONE THOUSAND DOLLARS ($1,000). +4.3 YOU AGREE THAT THE FOREGOING LIMITATIONS, EXCLUSIONS AND DISCLAIMERS ARE A REASONABLE ALLOCATION OF THE RISK BETWEEN THE PARTIES AND WILL APPLY TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, EVEN IF ANY REMEDY FAILS IN ITS ESSENTIAL PURPOSE. +5. MISCELLANEOUS +This Agreement, including Attachment 1 hereto, which is hereby incorporated herein by this reference, as well as any applicable Order Form and Subscription Agreement, completely and exclusively state the entire agreement of the parties regarding the subject matter herein, and it supersedes, and its terms govern, all prior proposals, agreements, or other communications between the parties, oral or written, regarding such subject matter. In the event of any conflict between the terms and conditions of any of the foregoing documents, the conflict shall be resolved based on the following order of precedence: (i) an applicable Order Form (but only for the transaction thereunder), (ii) an applicable Subscription Agreement, (iii) the Support Services Policy and (iv) this Agreement. For the avoidance of doubt, the parties hereby expressly acknowledge and agree that if You issue any purchase order or similar document in connection with the purchase of a Subscription and/or obtaining of License to the Software, You will do so only for Your internal, administrative purposes and not with the intent to provide any contractual terms. This Agreement may not be modified except by a subsequently dated, written amendment that expressly amends this Agreement and which is signed on behalf of Elastic and You, by duly authorized representatives. If any provision hereof is held unenforceable, this Agreement will continue without said provision and be interpreted to reflect the original intent of the parties. +6. DEFINITIONS +The following terms have the meanings ascribed: +6.1 “Affiliate” means, with respect to a party, any entity that controls, is controlled by, or which is under common control with, such party, where “control” means ownership of at least fifty percent (50%) of the outstanding voting shares of the entity, or the contractual right to establish policy for, and manage the operations of, the entity. +6.2 “Basic Version” means that version of the Software available for use without the purchase of a Subscription, but which does require Registration. +6.3 “Contractor” means any third party contractor performing services on Your behalf. +6.4 “Documentation” means the published end user documentation provided by Elastic with the Software. +6.5 “Eligible Features and Functions” means those features and functions of the Software that are eligible for use with respect to the particular version of the Software licensed by You or the Subscription level purchased by You. A list of the Eligible Features and Functions that correspond to each version of the Software and Subscription levels may be found at https://www.elastic.co/subscriptions. +6.6 “License” means a limited, non-exclusive, non-transferable, fully paid up, right and license (without the right to grant or authorize sublicenses) solely for Your internal business operations to (i) install and use, in object code format, the Software, (ii) use, and distribute internally a reasonable number of copies of the Documentation, provided that You must include on such copies all Marks and Notices; (iii) permit Contractors and Your Affiliates to use the Software and Documentation as set forth in (i) and (ii) above, provided that such use by Contractors must be solely for Your benefit, and You shall be responsible for all acts and omissions of such Contractors and Affiliates in connection with their use of the Software that are contrary to the terms and conditions of this Agreement. +6.7 “License Key” means an alphanumeric code that enables the Eligible Features and Functions of the Software. +6.8 “Malicious Code” means any code that is designed to harm, or otherwise disrupt in any unauthorized manner, the operation of Your computer programs or computer systems or destroy or damage data. For clarity, Malicious Code shall not include any software bugs or errors handled through Support Services, or any standard features of functions of the Software and/or any License Key that are intended to enforce the temporal and/or other limitations on the scope of the use of the Software to the scope of the License granted to You. +6.9 “Marks and Notices” means all Elastic trademarks, trade names, logos and notices present on the Documentation as originally provided by Elastic. +6.10 “Node” means an instance of Software on a single physical server or virtual machine, provided that all client Nodes are excluded from calculating Subscription fees based on the number of Nodes. +6.11 “Project” means a specific use case for the Software, with Nodes being deployed for use in a logical grouping of functionality to support such use case. +6.12 “Registration” means Elastic’s then-current process under which You may register Your use of the Software with Elastic by providing certain information to Elastic regarding You and Your use of the Software. +6.13 “Subscription” means the right to receive Support Services and a License to the Software. +6.14 “Subscription Agreement” means a legally enforceable agreement between You and Elastic, under which You purchase a Subscription. +6.15 “Subscription Level” means the level of Subscription purchased by You. The Subscription Level purchased by You determines the specific Support Services that You are entitled to receive, and the specific Eligible Features and functions that You are entitled to use. +6.16 “Subscription Term” means the period of time for which You have purchased a Subscription. +6.17 “Trial Version” means that version of the Software available for use without the purchase of a Subscription and without Registration. + +ATTACHMENT 1 +ADDITIONAL TERMS AND CONDITIONS + +A. The following additional terms and conditions apply to all Customers with principal offices in the United States of America: + +(1) Applicable Elasticsearch Entity. The entity providing the license is Elasticsearch, Inc., a Delaware corporation. + +(2) Government Rights. The Software product is "Commercial Computer Software," as that term is defined in 48 C.F.R. 2.101, and as the term is used in 48 C.F.R. Part 12, and is a Commercial Item comprised of "commercial computer software" and "commercial computer software documentation". If acquired by or on behalf of a civilian agency, the U.S. Government acquires this commercial computer software and/or commercial computer software documentation subject to the terms of this Agreement, as specified in 48 C.F.R. 12.212 (Computer Software) and 12.211 (Technical Data) of the Federal Acquisition Regulation ("FAR") and its successors. If acquired by or on behalf of any agency within the Department of Defense ("DOD"), the U.S. Government acquires this commercial computer software and/or commercial computer software documentation subject to the terms of the Elastic Software End User License Agreement as specified in 48 C.F.R. 227.7202-3 and 48 C.F.R. 227.7202-4 of the DOD FAR Supplement ("DFARS") and its successors, and consistent with 48 C.F.R. 227.7202. This U.S. Government Rights clause, consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202 is in lieu of, and supersedes, any other FAR, DFARS, or other clause or provision that addresses Government rights in computer software, computer software documentation or technical data related to the Software under this Agreement and in any Subcontract under which this commercial computer software and commercial computer software documentation is acquired or licensed. +(3) Export Control. You acknowledge that the goods, software and technology acquired from Elastic are subject to U.S. export control laws and regulations, including but not limited to the International Traffic In Arms Regulations (“ITAR”) (22 C.F.R. Parts 120-130 (2010)); the Export Administration Regulations ("EAR") (15 C.F.R. Parts 730-774 (2010)); the U.S. antiboycott regulations in the EAR and U.S. Department of the Treasury regulations; the economic sanctions regulations and guidelines of the U.S. Department of the Treasury, Office of Foreign Assets Control, and the USA Patriot Act (Title III of Pub. L. 107-56, signed into law October 26, 2001), as amended.  You are now and will remain in the future compliant with all such export control laws and regulations, and will not export, re-export, otherwise transfer any Elastic goods, software or technology or disclose any Elastic software or technology to any person contrary to such laws or regulations.  You acknowledge that remote access to the Software may in certain circumstances be considered a re-export of Software, and accordingly, may not be granted in contravention of U.S. export control laws and regulations. +(4) Governing Law, Jurisdiction and Venue. +(a) Customers in California. If Customer is located in California (as determined by the Customer address on the applicable Order Form, or for a trial license under 1.1(a), the location of person who installed the Software), this Agreement will be governed by the laws of the State of California, without regard to its conflict of laws principles, and all suits hereunder will be brought solely in Federal Court for the Northern District of California, or if that court lacks subject matter jurisdiction, in any California State Court located in Santa Clara County. +(b) Customers Outside of California. If Customer is located anywhere other than California (as determined by the Customer address on the applicable Order Form, or for a trial license under 1.1(a), the location of person who installed the Software), this Agreement will be governed by the laws of the State of Delaware, without regard to its conflict of laws principles, and all suits hereunder will be brought solely in Federal Court for the District of Delaware, or if that court lacks subject matter jurisdiction, in any Delaware State Court located in Wilmington, Delaware. +(c) All Customers. This Agreement shall not be governed by the 1980 UN Convention on Contracts for the International Sale of Goods. The parties hereby irrevocably waive any and all claims and defenses either might otherwise have in any action or proceeding in any of the applicable courts set forth in (a) or (b) above, based upon any alleged lack of personal jurisdiction, improper venue, forum non conveniens, or any similar claim or defense. +(d) Equitable Relief. A breach or threatened breach, by either party of Section 4 may cause irreparable harm for which the non-breaching party shall be entitled to seek injunctive relief without being required to post a bond. + +B. The following additional terms and conditions apply to all Customers with principal offices in Canada: + +(1) Applicable Elasticsearch Entity. The entity providing the license is Elasticsearch B.C. Ltd., a corporation incorporated under laws of the Province of British Columbia. + +(2) Export Control. You acknowledge that the goods, software and technology acquired from Elastic are subject to the restrictions and controls set out in Section A(3) above as well as those imposed by the Export and Import Permits Act (Canada) and the regulations thereunder and that you will comply with all applicable laws and regulations. Without limitation, You acknowledge that the Software, or any portion thereof, will not be exported: (a) to any country on Canada's Area Control List; (b) to any country subject to UN Security Council embargo or action; or (c) contrary to Canada's Export Control List Item 5505. You are now and will remain in the future compliant with all such export control laws and regulations, and will not export, re-export, otherwise transfer any Elastic goods, software or technology or disclose any Elastic software or technology to any person contrary to such laws or regulations.  You will not export or re-export the Software, or any portion thereof, directly or indirectly, in violation of the Canadian export administration laws and regulations to any country or end user, or to any end user who you know or have reason to know will utilize them in the design, development or production of nuclear, chemical or biological weapons. You further acknowledge that the Software product may include technical data subject to such Canadian export regulations. Elastic does not represent that the Software is appropriate or available for use in all countries. Elastic prohibits accessing materials from countries or states where contents are illegal. You are using the Software on your own initiative and you are responsible for compliance with all applicable laws. You hereby agree to indemnify Elastic and its Affiliates from any claims, actions, liability or expenses (including reasonable lawyers' fees) resulting from Your failure to act in accordance with the acknowledgements, agreements, and representations in this Section B(2). + (3) Governing Law and Dispute Resolution. This Agreement shall be governed by the Province of Ontario and the federal laws of Canada applicable therein without regard to conflict of laws provisions. The parties hereby irrevocably waive any and all claims and defenses either might otherwise have in any such action or proceeding in any of such courts based upon any alleged lack of personal jurisdiction, improper venue, forum non conveniens or any similar claim or defense. Any dispute, claim or controversy arising out of or relating to this Agreement or the existence, breach, termination, enforcement, interpretation or validity thereof, including the determination of the scope or applicability of this agreement to arbitrate, (each, a “Dispute”), which the parties are unable to resolve after good faith negotiations, shall be submitted first to the upper management level of the parties. The parties, through their upper management level representatives shall meet within thirty (30) days of the Dispute being referred to them and if the parties are unable to resolve such Dispute within thirty (30) days of meeting, the parties agree to seek to resolve the Dispute through mediation with ADR Chambers in the City of Toronto, Ontario, Canada before pursuing any other proceedings. The costs of the mediator shall be shared equally by the parties. If the Dispute has not been resolved within thirty (30) days of the notice to desire to mediate, any party may terminate the mediation and proceed to arbitration and the matter shall be referred to and finally resolved by arbitration at ADR Chambers pursuant to the general ADR Chambers Rules for Arbitration in the City of Toronto, Ontario, Canada. The arbitration shall proceed in accordance with the provisions of the Arbitration Act (Ontario). The arbitral panel shall consist of three (3) arbitrators, selected as follows: each party shall appoint one (1) arbitrator; and those two (2) arbitrators shall discuss and select a chairman. If the two (2) party-appointed arbitrators are unable to agree on the chairman, the chairman shall be selected in accordance with the applicable rules of the arbitration body. Each arbitrator shall be independent of each of the parties. The arbitrators shall have the authority to grant specific performance and to allocate between the parties the costs of arbitration (including service fees, arbitrator fees and all other fees related to the arbitration) in such equitable manner as the arbitrators may determine. The prevailing party in any arbitration shall be entitled to receive reimbursement of its reasonable expenses incurred in connection therewith. Judgment upon the award so rendered may be entered in a court having jurisdiction or application may be made to such court for judicial acceptance of any award and an order of enforcement, as the case may be. Notwithstanding the foregoing, Elastic shall have the right to institute an action in a court of proper jurisdiction for preliminary injunctive relief pending a final decision by the arbitrator, provided that a permanent injunction and damages shall only be awarded by the arbitrator. The language to be used in the arbitral proceedings shall be English. + (4) Language. Any translation of this Agreement is done for local requirements and in the event of a dispute between the English and any non-English version, the English version of this Agreement shall govern. At the request of the parties, the official language of this Agreement and all communications and documents relating hereto is the English language, and the English-language version shall govern all interpretation of the Agreement.  À la demande des parties, la langue officielle de la présente convention ainsi que toutes communications et tous documents s'y rapportant est la langue anglaise, et la version anglaise est celle qui régit toute interprétation de la présente convention. +(5) Warranty Disclaimer. For Customers with principal offices in the Province of Québec, the following new sentence is to be added to the end of Section 3.3: “SOME JURISDICTIONS DO NOT ALLOW LIMITATIONS OR EXCLUSIONS OF CERTAIN TYPES OF DAMAGES AND/OR WARRANTIES AND CONDITIONS. THE LIMITATIONS, EXCLUSIONS AND DISCLAIMERS SET FORTH IN THIS AGREEMENT SHALL NOT APPLY IF AND ONLY IF AND TO THE EXTENT THAT THE LAWS OF A COMPETENT JURISDICTION REQUIRE LIABILITIES BEYOND AND DESPITE THESE LIMITATIONS, EXCLUSIONS AND DISCLAIMERS.” +(6) Limitation of Liability. For Customers with principal offices in the Province of Québec, the following new sentence is to be added to the end of Section 4.1: “SOME JURISDICTIONS DO NOT ALLOW LIMITATIONS OR EXCLUSIONS OF CERTAIN TYPES OF DAMAGES AND/OR WARRANTIES AND CONDITIONS.  THE LIMITATIONS, EXCLUSIONS AND DISCLAIMERS SET FORTH IN THIS AGREEMENT SHALL NOT APPLY IF AND ONLY IF AND TO THE EXTENT THAT THE LAWS OF A COMPETENT JURISDICTION REQUIRE LIABILITIES BEYOND AND DESPITE THESE LIMITATIONS, EXCLUSIONS AND DISCLAIMERS.” + +C. The following additional terms and conditions apply to all Customers with principal offices outside of the United States of America and Canada: + +(1) Applicable Elasticsearch Entity. The entity providing the license in Germany is Elasticsearch Gmbh; in France is Elasticsearch SARL, in the United Kingdom is Elasticsearch Ltd, in Australia is Elasticsearch Pty Ltd., in Japan is Elasticsearch KK, in Sweden is Elasticsearch AB, in Norway is Elasticsearch AS and in all other countries is Elasticsearch BV. + +(2) Choice of Law. This Agreement shall be governed by and construed in accordance with the laws of the State of New York, without reference to or application of choice of law rules or principles. Notwithstanding any choice of law provision or otherwise, the Uniform Computer Information Transactions Act (UCITA) and the United Nations Convention on the International Sale of Goods shall not apply. + +(3) Arbitration. Any dispute, claim or controversy arising out of or relating to this Agreement or the existence, breach, termination, enforcement, interpretation or validity thereof, including the determination of the scope or applicability of this agreement to arbitrate, (each, a “Dispute”) shall be referred to and finally resolved by arbitration under the rules and at the location identified below. The arbitral panel shall consist of three (3) arbitrators, selected as follows: each party shall appoint one (1) arbitrator; and those two (2) arbitrators shall discuss and select a chairman. If the two party-appointed arbitrators are unable to agree on the chairman, the chairman shall be selected in accordance with the applicable rules of the arbitration body. Each arbitrator shall be independent of each of the parties. The arbitrators shall have the authority to grant specific performance and to allocate between the parties the costs of arbitration (including service fees, arbitrator fees and all other fees related to the arbitration) in such equitable manner as the arbitrators may determine. The prevailing party in any arbitration shall be entitled to receive reimbursement of its reasonable expenses incurred in connection therewith. Judgment upon the award so rendered may be entered in a court having jurisdiction or application may be made to such court for judicial acceptance of any award and an order of enforcement, as the case may be. Notwithstanding the foregoing, Elastic shall have the right to institute an action in a court of proper jurisdiction for preliminary injunctive relief pending a final decision by the arbitrator, provided that a permanent injunction and damages shall only be awarded by the arbitrator. The language to be used in the arbitral proceedings shall be English. + +In addition, the following terms only apply to Customers with principal offices within Europe, the Middle East or Africa (EMEA): + +Arbitration Rules and Location. Any Dispute shall be referred to and finally resolved by arbitration under the London Court of International Arbitration (“LCIA”) Rules (which Rules are deemed to be incorporated by reference into this clause) on the basis that the governing law is the law of the State of New York, USA. The seat, or legal place, of arbitration shall be London, England. + +(b) In addition, the following terms only apply to Customers with principal offices within Asia Pacific, Australia & New Zealand: + +Arbitration Rules and Location. Any Dispute shall be referred to and finally resolved by arbitration under the Rules of Conciliation and Arbitration of the International Chamber of Commerce (“ICC”) in force on the date when the notice of arbitration is submitted in accordance with such Rules (which Rules are deemed to be incorporated by reference into this clause) on the basis that the governing law is the law of the State of New York, USA. The seat, or legal place, of arbitration shall be Singapore. + +(c) In addition, the following terms only apply to Customers with principal offices within the Americas (excluding North America): + +Arbitration Rules and Location. Any Dispute shall be referred to and finally resolved by arbitration under International Dispute Resolution Procedures of the American Arbitration Association (“AAA”) in force on the date when the notice of arbitration is submitted in accordance with such Procedures (which Procedures are deemed to be incorporated by reference into this clause) on the basis that the governing law is the law of the State of New York, USA. The seat, or legal place, of arbitration shall be New York, New York, USA. + +(4) In addition, for Customers with principal offices within the UK, the following new sentence is added to the end of Section 4.1: + +Nothing in this Agreement shall have effect so as to limit or exclude a party’s liability for death or personal injury caused by negligence or for fraud including fraudulent misrepresentation and this Section 4.1 shall take effect subject to this provision. + +(5) In addition, for Customers with principal offices within France, Sections 1.2, 3 and 4.1 of the Agreement are deleted and replaced with the following new Sections 1.2, 3.3 and 4.1: +1.2 Reservation of Rights; Restrictions. Elastic owns all right title and interest in and to the Software and any derivative works thereof, and except as expressly set forth in Section 1.1 above, no other license to the Software is granted to You by implication, or otherwise. You agree not to prepare derivative works from, modify, copy or use the Software in any manner except as expressly permitted in this Agreement; provided that You may copy the Software for archival purposes, only where such software is provided on a non-durable medium; and You may decompile the Software, where necessary for interoperability purposes and where necessary for the correction of errors making the software unfit for its intended purpose, if such right is not reserved by Elastic as editor of the Software. Pursuant to article L122-6-1 of the French intellectual property code, Elastic reserves the right to correct any bugs as necessary for the Software to serve its intended purpose. You agree not to: (i) transfer, sell, rent, lease, distribute, sublicense, loan or otherwise transfer the Software in whole or in part to any third party; (ii) use the Software for providing time-sharing services, any software-as-a-service offering (“SaaS”), service bureau services or as part of an application services provider or other service offering; (iii) alter or remove any proprietary notices in the Software; or (iv) make available to any third party any analysis of the results of operation of the Software, including benchmarking results, without the prior written consent of Elastic. +3.3 Warranty Disclaimer. TO THE MAXIMUM EXTENT PERMITTED UNDER APPLICABLE LAW, THE SOFTWARE IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, AND ELASTIC AND ITS LICENSORS MAKE NO WARRANTIES WHETHER EXPRESSED, IMPLIED OR STATUTORY REGARDING OR RELATING TO THE SOFTWARE OR DOCUMENTATION. TO THE MAXIMUM EXTENT PERMITTED UNDER APPLICABLE LAW, ELASTIC AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT TO THE SOFTWARE AND DOCUMENTATION, AND WITH RESPECT TO THE USE OF THE FOREGOING. FURTHER, ELASTIC DOES NOT WARRANT RESULTS OF USE OR THAT THE SOFTWARE WILL BE ERROR FREE OR THAT THE USE OF THE SOFTWARE WILL BE UNINTERRUPTED. +4.1 Disclaimer of Certain Damages. IN NO EVENT SHALL YOU OR ELASTIC OR ITS LICENSORS BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF USE, BUSINESS INTERRUPTION, LOSS OF DATA, COST OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT OR UNFORESEEABLE DAMAGES OF ANY KIND IN CONNECTION WITH OR ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE, OR THE PERFORMANCE OF OR FAILURE TO PERFORM THIS AGREEMENT, WHETHER ALLEGED AS A BREACH OF CONTRACT OR TORTIOUS CONDUCT, INCLUDING NEGLIGENCE. THE LIMITATIONS OF LIABILITY SET FORTH IN THIS SECTION 4.1 SHALL NOT APPLY TO A BREACH, THROUGH GROSS NEGLIGENCE OR INTENTIONAL MISCONDUCT BY YOU, OF THE SCOPE OF THE LICENSE GRANTED IN SECTION 1.1, OR IN CASE OF DEATH OR PERSONAL INJURY. +(6) In addition, for Customers located within Australia: (a) Sections 3.1, 3.2 and 3.3 of the Agreement are deleted and replaced with the following new Sections 3.1, 3.2, 3.3, 3.4 and 3.5; and (b) Sections 4.1, 4.2 and 4.3 of the Agreement are deleted and replaced with the following new Sections 4.1, 4.2, and 4.3: +3.1 Despite anything in this Agreement, Elastic’s goods come with guarantees that cannot be excluded under the Australian Consumer Law (as set out in the Competition and Consumer Act 2010 (Cth)). You are entitled to a replacement or refund for a major failure and compensation for any other reasonably foreseeable loss or damage. You are also entitled to have the goods repaired or replaced if the goods fail to be of acceptable quality and the failure does not amount to a major failure. +3.2 Limited Performance Warranty. Subject to You purchasing a Subscription, Elastic warrants that during the applicable Subscription Term, the Software will perform in all material respects in accordance with the Documentation. In the event of a breach of the foregoing warranty during the Subscription Term and where You notify Elastic that the Software does not perform in all material respects in accordance with the Documentation, Elastic’s sole obligation, and Your exclusive remedy shall be for Elastic to (i) correct (at Elastic’s cost) any failure(s) of the Software to perform in all material respects in accordance with the Documentation or (ii) if Elastic is unable to provide such a correction within thirty (30) days of receipt of notice of the applicable non-conformity, You may elect to terminate this Agreement and the associated Subscription, and Elastic will promptly refund to You any pre-paid, unused fees paid by You to Elastic for the applicable Subscription. The warranty set forth in this Section 3.2 does not apply if the applicable Software or any portion thereof: (a) has been altered, except by or on behalf Elastic; (b) has not been used, installed, operated, repaired, or maintained in accordance with this Agreement and/or the Documentation; (c) has been subjected to abnormal physical or electrical stress, misuse, negligence, or accident; or (d) is used on equipment, products, or systems not meeting specifications identified by Elastic in the Documentation. Additionally, the warranties set forth herein only apply when notice of a warranty claim is provided to Elastic within the applicable warranty period specified herein and do not apply to any bug, defect or error caused by or attributable to software or hardware not supplied by Elastic. +3.3 For the purposes of Section 3.2, You must use the contact details set out below to notify Elastic that the Software does not perform in all material respects in accordance with the Documentation: +Elasticsearch Pty Ltd +4th Floor, 17-19 Alberta Street +Sydney, New South Wales, 2000, Australia + +3.4 Malicious Code. Elastic represents and warrants that prior to making it available for delivery to You, Elastic will use standard industry practices including, without limitation, the use of an updated commercial anti-virus program, to test the Software for Malicious Code and remove any Malicious Code it discovers. In the event of a breach of the foregoing warranty, Elastic’s sole obligation, and Your exclusive remedy shall be, at Elastic’s option, for Elastic to replace the Software with Software that does not contain any Malicious Code or to pay for the cost of the Software to be replaced with Software that does not contain any Malicious Code. +3.5 Warranty Disclaimer. NOTHING IN THIS AGREEMENT IS INTENDED TO LIMIT CUSTOMER’S NON-EXCLUDABLE RIGHTS UNDER THE COMPETITION AND CONSUMER ACT 2010 (CTH). EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT AND TO THE MAXIMUM EXTENT PERMITTED UNDER APPLICABLE LAW, THE SOFTWARE IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, AND ELASTIC AND ITS LICENSORS MAKE NO WARRANTIES WHETHER EXPRESSED, IMPLIED OR STATUTORY REGARDING OR RELATING TO THE SOFTWARE OR DOCUMENTATION. TO THE MAXIMUM EXTENT PERMITTED UNDER APPLICABLE LAW AND EXCEPT AS SET OUT IN THIS AGREEMENT, ELASTIC AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT WITH RESPECT TO THE SOFTWARE AND DOCUMENTATION, AND WITH RESPECT TO THE USE OF THE FOREGOING. FURTHER, ELASTIC DOES NOT WARRANT RESULTS OF USE OR THAT THE SOFTWARE WILL BE ERROR FREE OR THAT THE USE OF THE SOFTWARE WILL BE UNINTERRUPTED. +4.1 Disclaimer of Certain Damages. Subject to clause 4.3, a party is not liable for Consequential Loss however caused (including by the negligence of that party) suffered or incurred by the other party in connection with this agreement. “Consequential Loss” means loss of revenues, loss of reputation, indirect loss, loss of profits, consequential loss, loss of actual or anticipated savings, indirect loss, lost opportunities, including opportunities to enter into arrangements with third parties, loss or damage in connection with claims against by third parties, or loss or corruption or data. +4.2 Damages Cap. SUBJECT TO CLAUSES 4.1 AND 4.3, ANY LIABILITY OF ELASTIC FOR ANY LOSS OR DAMAGE, HOWEVER CAUSED (INCLUDING BY THE NEGLIGENCE OF ELASTIC), SUFFERED BY YOU IN CONNECTION WITH THIS AGREEMENT IS LIMITED TO ONE THOUSAND DOLLARS ($1,000). THE LIMITATION SET OUT IN THIS SECTION 4.2 IS AN AGGREGATE LIMIT FOR ALL CLAIMS, WHENEVER MADE. +4.3 Australian Consumer Law. IF THE COMPETITION AND CONSUMER ACT 2010 (CTH) OR ANY OTHER LEGISLATION STATES THAT THERE IS A GUARANTEE IN RELATION TO ANY GOOD OR SERVICE SUPPLIED BY ELASTIC IN CONNECTION WITH THIS AGREEMENT, AND ELASTIC’S LIABILITY FOR FAILING TO COMPLY WITH THAT GUARANTEE CANNOT BE EXCLUDED BUT MAY BE LIMITED, SECTIONS 4.1, 4.2 AND 4.3 DO NOT APPLY TO THAT LIABILITY. INSTEAD, ELASTIC’S LIABILITY FOR THAT FAILURE IS LIMITED TO (AT THE ELECTION OF ELASTIC), IN THE CASE OF A SUPPLY OF GOODS, ELASTIC REPLACING THE GOODS OR SUPPLYING EQUIVALENT GOODS OR REPAIRING THE GOODS, OR IN THE CASE OF A SUPPLY OF SERVICES, ELASTIC SUPPLYING THE SERVICES AGAIN OR PAYING THE COST OF HAVING THE SERVICES SUPPLIED AGAIN. +(7) In addition, for Customers with principal offices within Japan, Sections 1.2, 3 and 4.1 of the Agreement are deleted and replaced with the following new Sections 1.2, 3.3 and 4.1: +1.2 Reservation of Rights; Restrictions. As between Elastic and You, Elastic owns all right title and interest in and to the Software and any derivative works thereof, and except as expressly set forth in Section 1.1 above, no other license to the Software is granted to You by implication or otherwise. You agree not to: (i) prepare derivative works from, modify, copy or use the Software in any manner except as expressly permitted in this Agreement or applicable law; (ii) transfer, sell, rent, lease, distribute, sublicense, loan or otherwise transfer the Software in whole or in part to any third party; (iii) use the Software for providing time-sharing services, any software-as-a-service offering (“SaaS”), service bureau services or as part of an application services provider or other service offering; (iv) alter or remove any proprietary notices in the Software; or (v) make available to any third party any analysis of the results of operation of the Software, including benchmarking results, without the prior written consent of Elastic. +3.3 Warranty Disclaimer. TO THE MAXIMUM EXTENT PERMITTED UNDER APPLICABLE LAW, THE SOFTWARE IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, AND ELASTIC AND ITS LICENSORS MAKE NO WARRANTIES WHETHER EXPRESSED, IMPLIED OR STATUTORY REGARDING OR RELATING TO THE SOFTWARE OR DOCUMENTATION. TO THE MAXIMUM EXTENT PERMITTED UNDER APPLICABLE LAW, ELASTIC AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT WITH RESPECT TO THE SOFTWARE AND DOCUMENTATION, AND WITH RESPECT TO THE USE OF THE FOREGOING. FURTHER, ELASTIC DOES NOT WARRANT RESULTS OF USE OR THAT THE SOFTWARE WILL BE ERROR FREE OR THAT THE USE OF THE SOFTWARE WILL BE UNINTERRUPTED. +4.1 Disclaimer of Certain Damages. IN NO EVENT SHALL YOU OR ELASTIC OR ITS LICENSORS BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF USE, BUSINESS INTERRUPTION, LOSS OF DATA, COST OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY SPECIALINDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND IN CONNECTION WITH OR ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE, OR THE PERFORMANCE OF OR FAILURE TO PERFORM THIS AGREEMENT, WHETHER ALLEGED AS A BREACH OF CONTRACT OR TORTIOUS CONDUCT, INCLUDING NEGLIGENCE, EVEN IF THE RESPONSIBLE PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THE LIMITATIONS OF LIABILITY SET FORTH IN THIS SECTION 4.1 SHALL NOT APPLY TO A BREACH THROUGH GROSS NEGLIGENCE OR INTENTIONAL MISCONDUCT BY YOU OF THE SCOPE OF THE LICENSE GRANTED IN SECTION 1.1 OR TO ANY OTHER LIABILITY THAT CANNOT BE EXCLUDED OR LIMITED UNDER APPLICABLE LAW. diff --git a/plugin/licenses/x-pack-client-api-objects-NOTICE.txt b/plugin/licenses/x-pack-client-api-objects-NOTICE.txt new file mode 100644 index 00000000000..643a060cd05 --- /dev/null +++ b/plugin/licenses/x-pack-client-api-objects-NOTICE.txt @@ -0,0 +1,5 @@ +Elasticsearch +Copyright 2009-2017 Elasticsearch + +This product includes software developed by The Apache Software +Foundation (http://www.apache.org/). diff --git a/plugin/src/main/java/org/elasticsearch/xpack/XPackPlugin.java b/plugin/src/main/java/org/elasticsearch/xpack/XPackPlugin.java index 7ee33dd7080..8c79d55cac4 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/XPackPlugin.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/XPackPlugin.java @@ -63,14 +63,6 @@ import org.elasticsearch.xpack.action.TransportXPackInfoAction; import org.elasticsearch.xpack.action.TransportXPackUsageAction; import org.elasticsearch.xpack.action.XPackInfoAction; import org.elasticsearch.xpack.action.XPackUsageAction; -import org.elasticsearch.xpack.watcher.common.http.HttpClient; -import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.watcher.common.http.HttpSettings; -import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthFactory; -import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthRegistry; -import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuth; -import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuthFactory; -import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; import org.elasticsearch.xpack.deprecation.Deprecation; import org.elasticsearch.xpack.extensions.XPackExtension; import org.elasticsearch.xpack.extensions.XPackExtensionsService; @@ -82,19 +74,14 @@ import org.elasticsearch.xpack.ml.MachineLearning; import org.elasticsearch.xpack.ml.MachineLearningFeatureSet; import org.elasticsearch.xpack.monitoring.Monitoring; import org.elasticsearch.xpack.monitoring.MonitoringFeatureSet; -import org.elasticsearch.xpack.watcher.notification.email.Account; -import org.elasticsearch.xpack.watcher.notification.email.EmailService; -import org.elasticsearch.xpack.watcher.notification.email.attachment.DataAttachmentParser; -import org.elasticsearch.xpack.watcher.notification.email.attachment.EmailAttachmentParser; -import org.elasticsearch.xpack.watcher.notification.email.attachment.EmailAttachmentsParser; -import org.elasticsearch.xpack.watcher.notification.email.attachment.HttpEmailAttachementParser; -import org.elasticsearch.xpack.watcher.notification.email.attachment.ReportingAttachmentParser; -import org.elasticsearch.xpack.watcher.notification.email.support.BodyPartSource; -import org.elasticsearch.xpack.watcher.notification.hipchat.HipChatService; -import org.elasticsearch.xpack.watcher.notification.jira.JiraService; -import org.elasticsearch.xpack.watcher.notification.pagerduty.PagerDutyAccount; -import org.elasticsearch.xpack.watcher.notification.pagerduty.PagerDutyService; -import org.elasticsearch.xpack.watcher.notification.slack.SlackService; +import org.elasticsearch.xpack.persistent.CompletionPersistentTaskAction; +import org.elasticsearch.xpack.persistent.PersistentTasksClusterService; +import org.elasticsearch.xpack.persistent.PersistentTasksExecutor; +import org.elasticsearch.xpack.persistent.PersistentTasksExecutorRegistry; +import org.elasticsearch.xpack.persistent.PersistentTasksService; +import org.elasticsearch.xpack.persistent.RemovePersistentTaskAction; +import org.elasticsearch.xpack.persistent.StartPersistentTaskAction; +import org.elasticsearch.xpack.persistent.UpdatePersistentTaskStatusAction; import org.elasticsearch.xpack.rest.action.RestXPackInfoAction; import org.elasticsearch.xpack.rest.action.RestXPackUsageAction; import org.elasticsearch.xpack.security.InternalClient; @@ -112,6 +99,27 @@ import org.elasticsearch.xpack.ssl.SSLService; import org.elasticsearch.xpack.upgrade.Upgrade; import org.elasticsearch.xpack.watcher.Watcher; import org.elasticsearch.xpack.watcher.WatcherFeatureSet; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.HttpSettings; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthFactory; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthRegistry; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuth; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuthFactory; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.email.Account; +import org.elasticsearch.xpack.watcher.notification.email.EmailService; +import org.elasticsearch.xpack.watcher.notification.email.attachment.DataAttachmentParser; +import org.elasticsearch.xpack.watcher.notification.email.attachment.EmailAttachmentParser; +import org.elasticsearch.xpack.watcher.notification.email.attachment.EmailAttachmentsParser; +import org.elasticsearch.xpack.watcher.notification.email.attachment.HttpEmailAttachementParser; +import org.elasticsearch.xpack.watcher.notification.email.attachment.ReportingAttachmentParser; +import org.elasticsearch.xpack.watcher.notification.email.support.BodyPartSource; +import org.elasticsearch.xpack.watcher.notification.hipchat.HipChatService; +import org.elasticsearch.xpack.watcher.notification.jira.JiraService; +import org.elasticsearch.xpack.watcher.notification.pagerduty.PagerDutyAccount; +import org.elasticsearch.xpack.watcher.notification.pagerduty.PagerDutyService; +import org.elasticsearch.xpack.watcher.notification.slack.SlackService; import java.io.IOException; import java.io.UncheckedIOException; @@ -339,8 +347,12 @@ public class XPackPlugin extends Plugin implements ScriptPlugin, ActionPlugin, I components.addAll(watcher.createComponents(getClock(), scriptService, internalClient, licenseState, httpClient, httpTemplateParser, threadPool, clusterService, cryptoService, xContentRegistry, components)); + PersistentTasksService persistentTasksService = new PersistentTasksService(settings, clusterService, threadPool, internalClient); - components.addAll(machineLearning.createComponents(internalClient, clusterService, threadPool, xContentRegistry)); + components.addAll(machineLearning.createComponents(internalClient, clusterService, threadPool, xContentRegistry, + persistentTasksService)); + List> tasksExecutors = new ArrayList<>(); + tasksExecutors.addAll(machineLearning.createPersistentTasksExecutors(clusterService)); components.addAll(logstash.createComponents(internalClient, clusterService)); @@ -354,6 +366,12 @@ public class XPackPlugin extends Plugin implements ScriptPlugin, ActionPlugin, I * x-pack user. */ components.addAll(sql.createComponents(client, clusterService, securityCatalogFilter)); + PersistentTasksExecutorRegistry registry = new PersistentTasksExecutorRegistry(settings, tasksExecutors); + PersistentTasksClusterService persistentTasksClusterService = new PersistentTasksClusterService(settings, registry, clusterService); + components.add(persistentTasksClusterService); + components.add(persistentTasksService); + components.add(registry); + // just create the reloader as it will pull all of the loaded ssl configurations and start watching them new SSLConfigurationReloader(settings, env, sslService, resourceWatcherService); return components; @@ -473,6 +491,10 @@ public class XPackPlugin extends Plugin implements ScriptPlugin, ActionPlugin, I List> actions = new ArrayList<>(); actions.add(new ActionHandler<>(XPackInfoAction.INSTANCE, TransportXPackInfoAction.class)); actions.add(new ActionHandler<>(XPackUsageAction.INSTANCE, TransportXPackUsageAction.class)); + actions.add(new ActionHandler<>(StartPersistentTaskAction.INSTANCE, StartPersistentTaskAction.TransportAction.class)); + actions.add(new ActionHandler<>(UpdatePersistentTaskStatusAction.INSTANCE, UpdatePersistentTaskStatusAction.TransportAction.class)); + actions.add(new ActionHandler<>(RemovePersistentTaskAction.INSTANCE, RemovePersistentTaskAction.TransportAction.class)); + actions.add(new ActionHandler<>(CompletionPersistentTaskAction.INSTANCE, CompletionPersistentTaskAction.TransportAction.class)); actions.addAll(licensing.getActions()); actions.addAll(monitoring.getActions()); actions.addAll(security.getActions()); diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java index b83821313ed..dff6191a122 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java @@ -5,6 +5,7 @@ */ package org.elasticsearch.xpack.ml; +import org.apache.lucene.util.SetOnce; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionResponse; @@ -128,16 +129,11 @@ import org.elasticsearch.xpack.ml.rest.results.RestGetOverallBucketsAction; import org.elasticsearch.xpack.ml.rest.results.RestGetRecordsAction; import org.elasticsearch.xpack.ml.rest.validate.RestValidateDetectorAction; import org.elasticsearch.xpack.ml.rest.validate.RestValidateJobConfigAction; -import org.elasticsearch.xpack.persistent.CompletionPersistentTaskAction; import org.elasticsearch.xpack.persistent.PersistentTaskParams; -import org.elasticsearch.xpack.persistent.PersistentTasksClusterService; import org.elasticsearch.xpack.persistent.PersistentTasksCustomMetaData; -import org.elasticsearch.xpack.persistent.PersistentTasksExecutorRegistry; +import org.elasticsearch.xpack.persistent.PersistentTasksExecutor; import org.elasticsearch.xpack.persistent.PersistentTasksNodeService; import org.elasticsearch.xpack.persistent.PersistentTasksService; -import org.elasticsearch.xpack.persistent.RemovePersistentTaskAction; -import org.elasticsearch.xpack.persistent.StartPersistentTaskAction; -import org.elasticsearch.xpack.persistent.UpdatePersistentTaskStatusAction; import org.elasticsearch.xpack.security.InternalClient; import java.io.IOException; @@ -178,6 +174,9 @@ public class MachineLearning implements ActionPlugin { private final boolean tribeNode; private final boolean tribeNodeClient; + private final SetOnce autodetectProcessManager = new SetOnce<>(); + private final SetOnce datafeedManager = new SetOnce<>(); + public MachineLearning(Settings settings, Environment env, XPackLicenseState licenseState) { this.settings = settings; this.env = env; @@ -296,7 +295,7 @@ public class MachineLearning implements ActionPlugin { } public Collection createComponents(InternalClient internalClient, ClusterService clusterService, ThreadPool threadPool, - NamedXContentRegistry xContentRegistry) { + NamedXContentRegistry xContentRegistry, PersistentTasksService persistentTasksService) { if (enabled == false || transportClientMode || tribeNode || tribeNodeClient) { return emptyList(); } @@ -337,17 +336,14 @@ public class MachineLearning implements ActionPlugin { AutodetectProcessManager autodetectProcessManager = new AutodetectProcessManager(settings, internalClient, threadPool, jobManager, jobProvider, jobResultsPersister, jobDataCountsPersister, autodetectProcessFactory, normalizerFactory, xContentRegistry, auditor); - PersistentTasksService persistentTasksService = new PersistentTasksService(settings, clusterService, threadPool, internalClient); + this.autodetectProcessManager.set(autodetectProcessManager); DatafeedJobBuilder datafeedJobBuilder = new DatafeedJobBuilder(internalClient, jobProvider, auditor, System::currentTimeMillis); DatafeedManager datafeedManager = new DatafeedManager(threadPool, internalClient, clusterService, datafeedJobBuilder, System::currentTimeMillis, auditor, persistentTasksService); + this.datafeedManager.set(datafeedManager); MlLifeCycleService mlLifeCycleService = new MlLifeCycleService(env, clusterService, datafeedManager, autodetectProcessManager); InvalidLicenseEnforcer invalidLicenseEnforcer = new InvalidLicenseEnforcer(settings, licenseState, threadPool, datafeedManager, autodetectProcessManager); - PersistentTasksExecutorRegistry persistentTasksExecutorRegistry = new PersistentTasksExecutorRegistry(Settings.EMPTY, Arrays.asList( - new OpenJobAction.OpenJobPersistentTasksExecutor(settings, clusterService, autodetectProcessManager), - new StartDatafeedAction.StartDatafeedPersistentTasksExecutor(settings, datafeedManager) - )); return Arrays.asList( mlLifeCycleService, @@ -358,15 +354,23 @@ public class MachineLearning implements ActionPlugin { new MlInitializationService(settings, threadPool, clusterService, internalClient), jobDataCountsPersister, datafeedManager, - persistentTasksService, - persistentTasksExecutorRegistry, - new PersistentTasksClusterService(Settings.EMPTY, persistentTasksExecutorRegistry, clusterService), auditor, invalidLicenseEnforcer, new MlAssignmentNotifier(settings, auditor, clusterService) ); } + public List> createPersistentTasksExecutors(ClusterService clusterService) { + if (enabled == false || transportClientMode || tribeNode || tribeNodeClient) { + return emptyList(); + } + + return Arrays.asList( + new OpenJobAction.OpenJobPersistentTasksExecutor(settings, clusterService, autodetectProcessManager.get()), + new StartDatafeedAction.StartDatafeedPersistentTasksExecutor(settings, datafeedManager.get()) + ); + } + public Collection nodeModules() { List modules = new ArrayList<>(); @@ -466,10 +470,6 @@ public class MachineLearning implements ActionPlugin { new ActionHandler<>(StopDatafeedAction.INSTANCE, StopDatafeedAction.TransportAction.class), new ActionHandler<>(IsolateDatafeedAction.INSTANCE, IsolateDatafeedAction.TransportAction.class), new ActionHandler<>(DeleteModelSnapshotAction.INSTANCE, DeleteModelSnapshotAction.TransportAction.class), - new ActionHandler<>(StartPersistentTaskAction.INSTANCE, StartPersistentTaskAction.TransportAction.class), - new ActionHandler<>(UpdatePersistentTaskStatusAction.INSTANCE, UpdatePersistentTaskStatusAction.TransportAction.class), - new ActionHandler<>(CompletionPersistentTaskAction.INSTANCE, CompletionPersistentTaskAction.TransportAction.class), - new ActionHandler<>(RemovePersistentTaskAction.INSTANCE, RemovePersistentTaskAction.TransportAction.class), new ActionHandler<>(UpdateProcessAction.INSTANCE, UpdateProcessAction.TransportAction.class), new ActionHandler<>(DeleteExpiredDataAction.INSTANCE, DeleteExpiredDataAction.TransportAction.class), new ActionHandler<>(ForecastJobAction.INSTANCE, ForecastJobAction.TransportAction.class) diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java index 127aaa17b4f..8ca53d8fe9e 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java @@ -607,7 +607,7 @@ public class OpenJobAction extends Action { diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/action/StartDatafeedAction.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/action/StartDatafeedAction.java index 06cc24c5755..37d2d6581c8 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/action/StartDatafeedAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/action/StartDatafeedAction.java @@ -40,6 +40,7 @@ import org.elasticsearch.index.mapper.DateFieldMapper; import org.elasticsearch.license.LicenseUtils; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.RestStatus; +import org.elasticsearch.tasks.Task; import org.elasticsearch.tasks.TaskId; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; @@ -545,7 +546,7 @@ public class StartDatafeedAction } @Override - protected void nodeOperation(AllocatedPersistentTask allocatedPersistentTask, DatafeedParams params) { + protected void nodeOperation(AllocatedPersistentTask allocatedPersistentTask, DatafeedParams params, Task.Status status) { DatafeedTask datafeedTask = (DatafeedTask) allocatedPersistentTask; datafeedTask.datafeedManager = datafeedManager; datafeedManager.run(datafeedTask, diff --git a/plugin/src/main/java/org/elasticsearch/xpack/persistent/NodePersistentTasksExecutor.java b/plugin/src/main/java/org/elasticsearch/xpack/persistent/NodePersistentTasksExecutor.java index 8133fb4724d..9595883ffb5 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/persistent/NodePersistentTasksExecutor.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/persistent/NodePersistentTasksExecutor.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.persistent; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.util.concurrent.AbstractRunnable; +import org.elasticsearch.tasks.Task; import org.elasticsearch.threadpool.ThreadPool; /** @@ -22,6 +23,7 @@ public class NodePersistentTasksExecutor { } public void executeTask(@Nullable Params params, + @Nullable Task.Status status, AllocatedPersistentTask task, PersistentTasksExecutor executor) { threadPool.executor(executor.getExecutor()).execute(new AbstractRunnable() { @@ -34,7 +36,7 @@ public class NodePersistentTasksExecutor { @Override protected void doRun() throws Exception { try { - executor.nodeOperation(task, params); + executor.nodeOperation(task, params, status); } catch (Exception ex) { task.markAsFailed(ex); } diff --git a/plugin/src/main/java/org/elasticsearch/xpack/persistent/PersistentTasksExecutor.java b/plugin/src/main/java/org/elasticsearch/xpack/persistent/PersistentTasksExecutor.java index c39cde85425..4fe04febb07 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/persistent/PersistentTasksExecutor.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/persistent/PersistentTasksExecutor.java @@ -10,6 +10,7 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.tasks.Task; import org.elasticsearch.tasks.TaskId; import org.elasticsearch.xpack.persistent.PersistentTasksCustomMetaData.Assignment; import org.elasticsearch.xpack.persistent.PersistentTasksCustomMetaData.PersistentTask; @@ -101,10 +102,10 @@ public abstract class PersistentTasksExecutor - * NOTE: The nodeOperation has to throws an exception, trigger task.markAsCompleted() or task.completeAndNotifyIfNeeded() methods to + * NOTE: The nodeOperation has to throw an exception, trigger task.markAsCompleted() or task.completeAndNotifyIfNeeded() methods to * indicate that the persistent task has finished. */ - protected abstract void nodeOperation(AllocatedPersistentTask task, @Nullable Params params); + protected abstract void nodeOperation(AllocatedPersistentTask task, @Nullable Params params, @Nullable Task.Status status); public String getExecutor() { return executor; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/persistent/PersistentTasksNodeService.java b/plugin/src/main/java/org/elasticsearch/xpack/persistent/PersistentTasksNodeService.java index 03f53e0f05d..49246a8be20 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/persistent/PersistentTasksNodeService.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/persistent/PersistentTasksNodeService.java @@ -160,7 +160,7 @@ public class PersistentTasksNodeService extends AbstractComponent implements Clu task.getPersistentTaskId(), task.getAllocationId()); try { runningTasks.put(taskInProgress.getAllocationId(), task); - nodePersistentTasksExecutor.executeTask(taskInProgress.getParams(), task, executor); + nodePersistentTasksExecutor.executeTask(taskInProgress.getParams(), taskInProgress.getStatus(), task, executor); } catch (Exception e) { // Submit task failure task.markAsFailed(e); diff --git a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/SecurityRestFilter.java b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/SecurityRestFilter.java index 72c7bc0a9f5..03f729ca8dc 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/SecurityRestFilter.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/SecurityRestFilter.java @@ -52,7 +52,7 @@ public class SecurityRestFilter implements RestHandler { Netty4HttpRequest nettyHttpRequest = (Netty4HttpRequest) request; SslHandler handler = nettyHttpRequest.getChannel().pipeline().get(SslHandler.class); assert handler != null; - ServerTransportFilter.extactClientCertificates(logger, threadContext, handler.engine(), nettyHttpRequest.getChannel()); + ServerTransportFilter.extractClientCertificates(logger, threadContext, handler.engine(), nettyHttpRequest.getChannel()); } service.authenticate(maybeWrapRestRequest(request), ActionListener.wrap( authentication -> { diff --git a/plugin/src/main/java/org/elasticsearch/xpack/security/transport/ServerTransportFilter.java b/plugin/src/main/java/org/elasticsearch/xpack/security/transport/ServerTransportFilter.java index 22840e640d0..8a600be4f6d 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/security/transport/ServerTransportFilter.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/security/transport/ServerTransportFilter.java @@ -19,11 +19,12 @@ import org.elasticsearch.action.admin.indices.open.OpenIndexAction; import org.elasticsearch.action.support.DestructiveOperations; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.transport.DelegatingTransportChannel; +import org.elasticsearch.transport.TaskTransportChannel; import org.elasticsearch.transport.TcpTransportChannel; import org.elasticsearch.transport.TransportChannel; import org.elasticsearch.transport.TransportRequest; import org.elasticsearch.transport.TransportService; +import org.elasticsearch.transport.netty4.NettyTcpChannel; import org.elasticsearch.xpack.security.SecurityContext; import org.elasticsearch.xpack.security.action.SecurityActionMapper; import org.elasticsearch.xpack.security.authc.Authentication; @@ -109,17 +110,17 @@ public interface ServerTransportFilter { String securityAction = actionMapper.action(action, request); TransportChannel unwrappedChannel = transportChannel; - while (unwrappedChannel instanceof DelegatingTransportChannel) { - unwrappedChannel = ((DelegatingTransportChannel) unwrappedChannel).getChannel(); + if (unwrappedChannel instanceof TaskTransportChannel) { + unwrappedChannel = ((TaskTransportChannel) unwrappedChannel).getChannel(); } if (extractClientCert && (unwrappedChannel instanceof TcpTransportChannel) && - ((TcpTransportChannel) unwrappedChannel).getChannel() instanceof io.netty.channel.Channel) { - Channel channel = (io.netty.channel.Channel) ((TcpTransportChannel) unwrappedChannel).getChannel(); + ((TcpTransportChannel) unwrappedChannel).getChannel() instanceof NettyTcpChannel) { + Channel channel = ((NettyTcpChannel) ((TcpTransportChannel) unwrappedChannel).getChannel()).getLowLevelChannel(); SslHandler sslHandler = channel.pipeline().get(SslHandler.class); if (channel.isOpen()) { assert sslHandler != null : "channel [" + channel + "] did not have a ssl handler. pipeline " + channel.pipeline(); - extactClientCertificates(logger, threadContext, sslHandler.engine(), channel); + extractClientCertificates(logger, threadContext, sslHandler.engine(), channel); } } @@ -170,7 +171,7 @@ public interface ServerTransportFilter { } } - static void extactClientCertificates(Logger logger, ThreadContext threadContext, SSLEngine sslEngine, Object channel) { + static void extractClientCertificates(Logger logger, ThreadContext threadContext, SSLEngine sslEngine, Channel channel) { try { Certificate[] certs = sslEngine.getSession().getPeerCertificates(); if (certs instanceof X509Certificate[]) { diff --git a/plugin/src/main/java/org/elasticsearch/xpack/security/transport/netty4/SecurityNetty4Transport.java b/plugin/src/main/java/org/elasticsearch/xpack/security/transport/netty4/SecurityNetty4Transport.java index 24b3106dd47..354b1a4b844 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/security/transport/netty4/SecurityNetty4Transport.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/security/transport/netty4/SecurityNetty4Transport.java @@ -19,8 +19,10 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.indices.breaker.CircuitBreakerService; import org.elasticsearch.threadpool.ThreadPool; +import org.elasticsearch.transport.TcpChannel; import org.elasticsearch.transport.TcpTransport; import org.elasticsearch.transport.netty4.Netty4Transport; +import org.elasticsearch.transport.netty4.NettyTcpChannel; import org.elasticsearch.xpack.XPackSettings; import org.elasticsearch.xpack.ssl.SSLConfiguration; import org.elasticsearch.xpack.ssl.SSLService; @@ -107,10 +109,10 @@ public class SecurityNetty4Transport extends Netty4Transport { } @Override - protected void onException(Channel channel, Exception e) { + protected void onException(NettyTcpChannel channel, Exception e) { if (!lifecycle.started()) { // just close and ignore - we are already stopped and just need to make sure we release all resources - closeChannelWhileHandlingExceptions(channel); + TcpChannel.closeChannel(channel, false); } else if (isNotSslRecordException(e)) { if (logger.isTraceEnabled()) { logger.trace( @@ -118,21 +120,21 @@ public class SecurityNetty4Transport extends Netty4Transport { } else { logger.warn("received plaintext traffic on an encrypted channel, closing connection {}", channel); } - closeChannelWhileHandlingExceptions(channel); + TcpChannel.closeChannel(channel, false); } else if (isCloseDuringHandshakeException(e)) { if (logger.isTraceEnabled()) { logger.trace(new ParameterizedMessage("connection {} closed during ssl handshake", channel), e); } else { logger.warn("connection {} closed during handshake", channel); } - closeChannelWhileHandlingExceptions(channel); + TcpChannel.closeChannel(channel, false); } else if (isReceivedCertificateUnknownException(e)) { if (logger.isTraceEnabled()) { logger.trace(new ParameterizedMessage("client did not trust server's certificate, closing connection {}", channel), e); } else { logger.warn("client did not trust this server's certificate, closing connection {}", channel); } - closeChannelWhileHandlingExceptions(channel); + TcpChannel.closeChannel(channel, false); } else { super.onException(channel, e); } diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/NotificationService.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/NotificationService.java index 5e2d06a8510..60ae0240d52 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/NotificationService.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/NotificationService.java @@ -20,12 +20,14 @@ import java.util.function.BiFunction; */ public abstract class NotificationService extends AbstractComponent { + private final String type; // both are guarded by this private Map accounts; protected Account defaultAccount; - public NotificationService(Settings settings) { + public NotificationService(Settings settings, String type) { super(settings); + this.type = type; } protected synchronized void setAccountSetting(Settings settings) { @@ -46,6 +48,10 @@ public abstract class NotificationService extends AbstractComponent { defaultAccount = this.defaultAccount; } Account theAccount = accounts.getOrDefault(name, defaultAccount); + if (theAccount == null && name == null) { + throw new IllegalArgumentException("no accounts of type [" + type + "] configured. " + + "Please set up an account using the [xpack.notification." + type +"] settings"); + } if (theAccount == null) { throw new IllegalArgumentException("no account found for name: [" + name + "]"); } diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/EmailService.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/EmailService.java index b0bb870c89f..6a655be7162 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/EmailService.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/EmailService.java @@ -24,7 +24,7 @@ public class EmailService extends NotificationService { Setting.groupSetting("xpack.notification.email.", Setting.Property.Dynamic, Setting.Property.NodeScope); public EmailService(Settings settings, @Nullable CryptoService cryptoService, ClusterSettings clusterSettings) { - super(settings); + super(settings, "email"); this.cryptoService = cryptoService; clusterSettings.addSettingsUpdateConsumer(EMAIL_ACCOUNT_SETTING, this::setAccountSetting); setAccountSetting(EMAIL_ACCOUNT_SETTING.get(settings)); diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatService.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatService.java index aacb2d9d2ca..11631018358 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatService.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatService.java @@ -23,7 +23,7 @@ public class HipChatService extends NotificationService { private HipChatServer defaultServer; public HipChatService(Settings settings, HttpClient httpClient, ClusterSettings clusterSettings) { - super(settings); + super(settings, "hipchat"); this.httpClient = httpClient; clusterSettings.addSettingsUpdateConsumer(HIPCHAT_ACCOUNT_SETTING, this::setAccountSetting); setAccountSetting(HIPCHAT_ACCOUNT_SETTING.get(settings)); diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/jira/JiraService.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/jira/JiraService.java index cb1a9d77107..318bbb1db01 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/jira/JiraService.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/jira/JiraService.java @@ -24,7 +24,7 @@ public class JiraService extends NotificationService { private final HttpClient httpClient; public JiraService(Settings settings, HttpClient httpClient, ClusterSettings clusterSettings) { - super(settings); + super(settings, "jira"); this.httpClient = httpClient; clusterSettings.addSettingsUpdateConsumer(JIRA_ACCOUNT_SETTING, this::setAccountSetting); setAccountSetting(JIRA_ACCOUNT_SETTING.get(settings)); diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/pagerduty/PagerDutyService.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/pagerduty/PagerDutyService.java index a38e83a80ba..10d20b458c8 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/pagerduty/PagerDutyService.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/pagerduty/PagerDutyService.java @@ -22,7 +22,7 @@ public class PagerDutyService extends NotificationService { private final HttpClient httpClient; public PagerDutyService(Settings settings, HttpClient httpClient, ClusterSettings clusterSettings) { - super(settings); + super(settings, "pagerduty"); this.httpClient = httpClient; clusterSettings.addSettingsUpdateConsumer(PAGERDUTY_ACCOUNT_SETTING, this::setAccountSetting); setAccountSetting(PAGERDUTY_ACCOUNT_SETTING.get(settings)); @@ -32,5 +32,4 @@ public class PagerDutyService extends NotificationService { protected PagerDutyAccount createAccount(String name, Settings accountSettings) { return new PagerDutyAccount(name, accountSettings, accountSettings, httpClient, logger); } - } diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/slack/SlackService.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/slack/SlackService.java index 9bb3f3dc50a..fb8dc4c86c6 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/slack/SlackService.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/slack/SlackService.java @@ -16,12 +16,13 @@ import org.elasticsearch.xpack.watcher.notification.NotificationService; */ public class SlackService extends NotificationService { - private final HttpClient httpClient; public static final Setting SLACK_ACCOUNT_SETTING = Setting.groupSetting("xpack.notification.slack.", Setting.Property.Dynamic, Setting.Property.NodeScope); + private final HttpClient httpClient; + public SlackService(Settings settings, HttpClient httpClient, ClusterSettings clusterSettings) { - super(settings); + super(settings, "slack"); this.httpClient = httpClient; clusterSettings.addSettingsUpdateConsumer(SLACK_ACCOUNT_SETTING, this::setAccountSetting); setAccountSetting(SLACK_ACCOUNT_SETTING.get(settings)); @@ -31,5 +32,4 @@ public class SlackService extends NotificationService { protected SlackAccount createAccount(String name, Settings accountSettings) { return new SlackAccount(name, accountSettings, accountSettings, httpClient, logger); } - } diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/NotificationServiceTests.java b/plugin/src/test/java/org/elasticsearch/xpack/notification/NotificationServiceTests.java new file mode 100644 index 00000000000..143e8454211 --- /dev/null +++ b/plugin/src/test/java/org/elasticsearch/xpack/notification/NotificationServiceTests.java @@ -0,0 +1,93 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +package org.elasticsearch.xpack.notification; + +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.SettingsException; +import org.elasticsearch.test.ESTestCase; +import org.elasticsearch.xpack.watcher.notification.NotificationService; + +import static org.hamcrest.Matchers.anyOf; +import static org.hamcrest.Matchers.is; + +public class NotificationServiceTests extends ESTestCase { + + public void testSingleAccount() throws Exception { + String accountName = randomAlphaOfLength(10); + Settings settings = Settings.builder().put("account." + accountName, "bar").build(); + + TestNotificationService service = new TestNotificationService(settings); + assertThat(service.getAccount(accountName), is(accountName)); + // single account, this will also be the default + assertThat(service.getAccount("non-existing"), is(accountName)); + } + + public void testMultipleAccountsWithExistingDefault() throws Exception { + String accountName = randomAlphaOfLength(10); + Settings settings = Settings.builder() + .put("account." + accountName, "bar") + .put("account.second", "bar") + .put("default_account", accountName) + .build(); + + TestNotificationService service = new TestNotificationService(settings); + assertThat(service.getAccount(accountName), is(accountName)); + assertThat(service.getAccount("second"), is("second")); + assertThat(service.getAccount("non-existing"), is(accountName)); + } + + public void testMultipleAccountsWithNoDefault() throws Exception { + String accountName = randomAlphaOfLength(10); + Settings settings = Settings.builder() + .put("account." + accountName, "bar") + .put("account.second", "bar") + .put("account.third", "bar") + .build(); + + TestNotificationService service = new TestNotificationService(settings); + assertThat(service.getAccount(null), anyOf(is(accountName), is("second"), is("third"))); + } + + public void testMultipleAccountsUnknownDefault() throws Exception { + String accountName = randomAlphaOfLength(10); + Settings settings = Settings.builder() + .put("account." + accountName, "bar") + .put("account.second", "bar") + .put("default_account", "non-existing") + .build(); + + SettingsException e = expectThrows(SettingsException.class, () -> new TestNotificationService(settings)); + assertThat(e.getMessage(), is("could not find default account [non-existing]")); + } + + public void testNoSpecifiedDefaultAccount() throws Exception { + String accountName = randomAlphaOfLength(10); + Settings settings = Settings.builder().put("account." + accountName, "bar").build(); + + TestNotificationService service = new TestNotificationService(settings); + assertThat(service.getAccount(null), is(accountName)); + } + + public void testAccountDoesNotExist() throws Exception{ + TestNotificationService service = new TestNotificationService(Settings.EMPTY); + IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> service.getAccount(null)); + assertThat(e.getMessage(), + is("no accounts of type [test] configured. Please set up an account using the [xpack.notification.test] settings")); + } + + private static class TestNotificationService extends NotificationService { + + TestNotificationService(Settings settings) { + super(settings, "test"); + setAccountSetting(settings); + } + + @Override + protected String createAccount(String name, Settings accountSettings) { + return name; + } + } +} \ No newline at end of file diff --git a/plugin/src/test/java/org/elasticsearch/xpack/persistent/PersistentTasksNodeServiceTests.java b/plugin/src/test/java/org/elasticsearch/xpack/persistent/PersistentTasksNodeServiceTests.java index 8dcd23f193f..ec049e088a4 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/persistent/PersistentTasksNodeServiceTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/persistent/PersistentTasksNodeServiceTests.java @@ -35,12 +35,14 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import static org.hamcrest.Matchers.empty; +import static org.hamcrest.Matchers.sameInstance; import static org.hamcrest.core.IsEqual.equalTo; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyLong; import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; public class PersistentTasksNodeServiceTests extends ESTestCase { @@ -153,6 +155,41 @@ public class PersistentTasksNodeServiceTests extends ESTestCase { } + public void testParamsStatusAndNodeTaskAreDelegated() throws Exception { + PersistentTasksService persistentTasksService = mock(PersistentTasksService.class); + @SuppressWarnings("unchecked") PersistentTasksExecutor action = mock(PersistentTasksExecutor.class); + when(action.getExecutor()).thenReturn(ThreadPool.Names.SAME); + when(action.getTaskName()).thenReturn(TestPersistentTasksExecutor.NAME); + TaskId parentId = new TaskId("cluster", 1); + AllocatedPersistentTask nodeTask = new TestPersistentTasksPlugin.TestTask(0, "persistent", "test", "", parentId); + when(action.createTask(anyLong(), anyString(), anyString(), eq(parentId), any())).thenReturn(nodeTask); + PersistentTasksExecutorRegistry registry = new PersistentTasksExecutorRegistry(Settings.EMPTY, Collections.singletonList(action)); + + MockExecutor executor = new MockExecutor(); + PersistentTasksNodeService coordinator = new PersistentTasksNodeService(Settings.EMPTY, persistentTasksService, + registry, new TaskManager(Settings.EMPTY), executor); + + ClusterState state = createInitialClusterState(1, Settings.EMPTY); + + Task.Status status = new TestPersistentTasksPlugin.Status("_test_phase"); + PersistentTasksCustomMetaData.Builder tasks = PersistentTasksCustomMetaData.builder(); + String taskId = UUIDs.base64UUID(); + TestParams taskParams = new TestParams("other_0"); + tasks.addTask(taskId, TestPersistentTasksExecutor.NAME, taskParams, + new Assignment("this_node", "test assignment on other node")); + tasks.updateTaskStatus(taskId, status); + MetaData.Builder metaData = MetaData.builder(state.metaData()); + metaData.putCustom(PersistentTasksCustomMetaData.TYPE, tasks.build()); + ClusterState newClusterState = ClusterState.builder(state).metaData(metaData).build(); + + coordinator.clusterChanged(new ClusterChangedEvent("test", newClusterState, state)); + + assertThat(executor.size(), equalTo(1)); + assertThat(executor.get(0).params, sameInstance(taskParams)); + assertThat(executor.get(0).status, sameInstance(status)); + assertThat(executor.get(0).task, sameInstance(nodeTask)); + } + public void testTaskCancellation() { AtomicLong capturedTaskId = new AtomicLong(); AtomicReference> capturedListener = new AtomicReference<>(); @@ -257,11 +294,13 @@ public class PersistentTasksNodeServiceTests extends ESTestCase { private class Execution { private final PersistentTaskParams params; private final AllocatedPersistentTask task; + private final Task.Status status; private final PersistentTasksExecutor holder; - Execution(PersistentTaskParams params, AllocatedPersistentTask task, PersistentTasksExecutor holder) { + Execution(PersistentTaskParams params, AllocatedPersistentTask task, Task.Status status, PersistentTasksExecutor holder) { this.params = params; this.task = task; + this.status = status; this.holder = holder; } } @@ -274,9 +313,11 @@ public class PersistentTasksNodeServiceTests extends ESTestCase { } @Override - public void executeTask(Params params, AllocatedPersistentTask task, + public void executeTask(Params params, + Task.Status status, + AllocatedPersistentTask task, PersistentTasksExecutor executor) { - executions.add(new Execution(params, task, executor)); + executions.add(new Execution(params, task, status, executor)); } public Execution get(int i) { diff --git a/plugin/src/test/java/org/elasticsearch/xpack/persistent/TestPersistentTasksPlugin.java b/plugin/src/test/java/org/elasticsearch/xpack/persistent/TestPersistentTasksPlugin.java index 218daa6f7f3..980ac6484fc 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/persistent/TestPersistentTasksPlugin.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/persistent/TestPersistentTasksPlugin.java @@ -309,7 +309,7 @@ public class TestPersistentTasksPlugin extends Plugin implements ActionPlugin { } @Override - protected void nodeOperation(AllocatedPersistentTask task, TestParams params) { + protected void nodeOperation(AllocatedPersistentTask task, TestParams params, Task.Status status) { logger.info("started node operation for the task {}", task); try { TestTask testTask = (TestTask) task; @@ -332,9 +332,9 @@ public class TestPersistentTasksPlugin extends Plugin implements ActionPlugin { } else if ("update_status".equals(testTask.getOperation())) { testTask.setOperation(null); CountDownLatch latch = new CountDownLatch(1); - Status status = new Status("phase " + phase.incrementAndGet()); - logger.info("updating the task status to {}", status); - task.updatePersistentStatus(status, new ActionListener>() { + Status newStatus = new Status("phase " + phase.incrementAndGet()); + logger.info("updating the task status to {}", newStatus); + task.updatePersistentStatus(newStatus, new ActionListener>() { @Override public void onResponse(PersistentTask persistentTask) { logger.info("updating was successful"); diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionFactoryTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionFactoryTests.java index ea821b67810..49fe4090e67 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionFactoryTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionFactoryTests.java @@ -5,34 +5,27 @@ */ package org.elasticsearch.xpack.watcher.actions.jira; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; import org.elasticsearch.xpack.watcher.notification.jira.JiraAccount; import org.elasticsearch.xpack.watcher.notification.jira.JiraService; import org.junit.Before; -import static java.util.Collections.singleton; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.xpack.watcher.notification.jira.JiraAccountTests.randomIssueDefaults; import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.jiraAction; -import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class JiraActionFactoryTests extends ESTestCase { - private JiraActionFactory factory; private JiraService service; @Before public void init() throws Exception { service = mock(JiraService.class); - factory = new JiraActionFactory(Settings.EMPTY, mock(TextTemplateEngine.class), service); } public void testParseAction() throws Exception { @@ -47,18 +40,4 @@ public class JiraActionFactoryTests extends ESTestCase { JiraAction parsedAction = JiraAction.parse("_w1", "_a1", parser); assertThat(parsedAction, equalTo(action)); } - - public void testParseActionUnknownAccount() throws Exception { - ClusterSettings clusterSettings = new ClusterSettings(Settings.EMPTY, singleton(JiraService.JIRA_ACCOUNT_SETTING)); - JiraService service = new JiraService(Settings.EMPTY, null, clusterSettings); - factory = new JiraActionFactory(Settings.EMPTY, mock(TextTemplateEngine.class), service); - - JiraAction action = jiraAction("_unknown", randomIssueDefaults()).build(); - XContentBuilder jsonBuilder = jsonBuilder().value(action); - XContentParser parser = createParser(jsonBuilder); - parser.nextToken(); - - IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> factory.parseExecutable("_w1", "_a1", parser)); - assertThat(e.getMessage(), containsString("no account found for name: [_unknown]")); - } } diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatAccountsTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatAccountsTests.java index b624c37d02e..8635d4982c7 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatAccountsTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatAccountsTests.java @@ -7,7 +7,6 @@ package org.elasticsearch.xpack.watcher.notification.hipchat; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.watcher.common.http.HttpClient; import org.elasticsearch.xpack.watcher.common.http.HttpProxy; @@ -21,10 +20,7 @@ import org.mockito.ArgumentCaptor; import java.util.Collections; import java.util.HashMap; -import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.isOneOf; -import static org.hamcrest.Matchers.notNullValue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -36,110 +32,6 @@ public class HipChatAccountsTests extends ESTestCase { httpClient = mock(HttpClient.class); } - public void testSingleAccount() throws Exception { - Settings.Builder builder = Settings.builder() - .put("xpack.notification.hipchat.default_account", "account1"); - addAccountSettings("account1", builder); - HipChatService service = new HipChatService(builder.build(), httpClient, new ClusterSettings(Settings.EMPTY, - Collections.singleton(HipChatService.HIPCHAT_ACCOUNT_SETTING))); - HipChatAccount account = service.getAccount("account1"); - assertThat(account, notNullValue()); - assertThat(account.name, equalTo("account1")); - account = service.getAccount(null); // falling back on the default - assertThat(account, notNullValue()); - assertThat(account.name, equalTo("account1")); - } - - public void testSingleAccountNoExplicitDefault() throws Exception { - Settings.Builder builder = Settings.builder(); - addAccountSettings("account1", builder); - - HipChatService service = new HipChatService(builder.build(), httpClient, new ClusterSettings(Settings.EMPTY, - Collections.singleton(HipChatService.HIPCHAT_ACCOUNT_SETTING))); - HipChatAccount account = service.getAccount("account1"); - assertThat(account, notNullValue()); - assertThat(account.name, equalTo("account1")); - account = service.getAccount(null); // falling back on the default - assertThat(account, notNullValue()); - assertThat(account.name, equalTo("account1")); - } - - public void testMultipleAccounts() throws Exception { - Settings.Builder builder = Settings.builder() - .put("xpack.notification.hipchat.default_account", "account1"); - addAccountSettings("account1", builder); - addAccountSettings("account2", builder); - - HipChatService service = new HipChatService(builder.build(), httpClient, new ClusterSettings(Settings.EMPTY, - Collections.singleton(HipChatService.HIPCHAT_ACCOUNT_SETTING))); - HipChatAccount account = service.getAccount("account1"); - assertThat(account, notNullValue()); - assertThat(account.name, equalTo("account1")); - account = service.getAccount("account2"); - assertThat(account, notNullValue()); - assertThat(account.name, equalTo("account2")); - account = service.getAccount(null); // falling back on the default - assertThat(account, notNullValue()); - assertThat(account.name, equalTo("account1")); - } - - public void testMultipleAccountsNoExplicitDefault() throws Exception { - Settings.Builder builder = Settings.builder() - .put("xpack.notification.hipchat.default_account", "account1"); - addAccountSettings("account1", builder); - addAccountSettings("account2", builder); - - HipChatService service = new HipChatService(builder.build(), httpClient, new ClusterSettings(Settings.EMPTY, - Collections.singleton(HipChatService.HIPCHAT_ACCOUNT_SETTING))); - HipChatAccount account = service.getAccount("account1"); - assertThat(account, notNullValue()); - assertThat(account.name, equalTo("account1")); - account = service.getAccount("account2"); - assertThat(account, notNullValue()); - assertThat(account.name, equalTo("account2")); - account = service.getAccount(null); - assertThat(account, notNullValue()); - assertThat(account.name, isOneOf("account1", "account2")); - } - - public void testMultipleAccountsUnknownDefault() throws Exception { - Settings.Builder builder = Settings.builder() - .put("xpack.notification.hipchat.default_account", "unknown"); - addAccountSettings("account1", builder); - addAccountSettings("account2", builder); - try { - new HipChatService(builder.build(), httpClient, new ClusterSettings(Settings.EMPTY, - Collections.singleton(HipChatService.HIPCHAT_ACCOUNT_SETTING))); - fail("Expected SettingsException"); - } catch (SettingsException e) { - assertThat(e.getMessage(), is("could not find default account [unknown]")); - } - } - - public void testNoAccount() throws Exception { - Settings.Builder builder = Settings.builder(); - HipChatService service = new HipChatService(builder.build(), httpClient, new ClusterSettings(Settings.EMPTY, - Collections.singleton(HipChatService.HIPCHAT_ACCOUNT_SETTING))); - try { - service.getAccount(null); - fail("no accounts are configured so trying to get the default account should throw an IllegalStateException"); - } catch (IllegalArgumentException e) { - assertThat(e.getMessage(), is("no account found for name: [null]")); - } - } - - public void testNoAccountWithDefaultAccount() throws Exception { - Settings.Builder builder = Settings.builder() - .put("xpack.notification.hipchat.default_account", "unknown"); - try { - new HipChatService(builder.build(), httpClient, new ClusterSettings(Settings.EMPTY, - Collections.singleton(HipChatService.HIPCHAT_ACCOUNT_SETTING))); - fail("Expected SettingsException"); - } catch (SettingsException e) { - assertThat(e.getMessage(), is("could not find default account [unknown]")); - } - } - public void testProxy() throws Exception { Settings.Builder builder = Settings.builder() .put("xpack.notification.hipchat.default_account", "account1"); @@ -152,7 +44,7 @@ public class HipChatAccountsTests extends ESTestCase { .addRooms(new TextTemplate("room")) .setFrom("from") .build(); - HipChatMessage hipChatMessage = template.render(new MockTextTemplateEngine(), new HashMap()); + HipChatMessage hipChatMessage = template.render(new MockTextTemplateEngine(), new HashMap<>()); ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(HttpRequest.class); when(httpClient.execute(argumentCaptor.capture())).thenReturn(new HttpResponse(200)); diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/jira/JiraAccountTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/jira/JiraAccountTests.java index 7b765563e3c..f6b45784d3a 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/jira/JiraAccountTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/jira/JiraAccountTests.java @@ -32,7 +32,6 @@ import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.isOneOf; import static org.hamcrest.Matchers.notNullValue; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; @@ -74,91 +73,6 @@ public class JiraAccountTests extends ESTestCase { assertThat(e.getMessage(), containsString("invalid jira [test] account settings. missing required [password] setting")); } - public void testSingleAccount() throws Exception { - Settings.Builder builder = Settings.builder().put("xpack.notification.jira.default_account", "account1"); - addAccountSettings("account1", builder); - - JiraService service = new JiraService(builder.build(), httpClient, clusterSettings); - JiraAccount account = service.getAccount("account1"); - assertThat(account, notNullValue()); - assertThat(account.getName(), equalTo("account1")); - account = service.getAccount(null); // falling back on the default - assertThat(account, notNullValue()); - assertThat(account.getName(), equalTo("account1")); - } - - public void testSingleAccountNoExplicitDefault() throws Exception { - Settings.Builder builder = Settings.builder(); - addAccountSettings("account1", builder); - - JiraService service = new JiraService(builder.build(), httpClient, clusterSettings); - JiraAccount account = service.getAccount("account1"); - assertThat(account, notNullValue()); - assertThat(account.getName(), equalTo("account1")); - account = service.getAccount(null); // falling back on the default - assertThat(account, notNullValue()); - assertThat(account.getName(), equalTo("account1")); - } - - public void testMultipleAccounts() throws Exception { - Settings.Builder builder = Settings.builder().put("xpack.notification.jira.default_account", "account1"); - addAccountSettings("account1", builder); - addAccountSettings("account2", builder); - - JiraService service = new JiraService(builder.build(), httpClient, clusterSettings); - JiraAccount account = service.getAccount("account1"); - assertThat(account, notNullValue()); - assertThat(account.getName(), equalTo("account1")); - account = service.getAccount("account2"); - assertThat(account, notNullValue()); - assertThat(account.getName(), equalTo("account2")); - account = service.getAccount(null); // falling back on the default - assertThat(account, notNullValue()); - assertThat(account.getName(), equalTo("account1")); - } - - public void testMultipleAccountsNoExplicitDefault() throws Exception { - Settings.Builder builder = Settings.builder().put("xpack.notification.jira.default_account", "account1"); - addAccountSettings("account1", builder); - addAccountSettings("account2", builder); - - JiraService service = new JiraService(builder.build(), httpClient, clusterSettings); - JiraAccount account = service.getAccount("account1"); - assertThat(account, notNullValue()); - assertThat(account.getName(), equalTo("account1")); - account = service.getAccount("account2"); - assertThat(account, notNullValue()); - assertThat(account.getName(), equalTo("account2")); - account = service.getAccount(null); - assertThat(account, notNullValue()); - assertThat(account.getName(), isOneOf("account1", "account2")); - } - - public void testMultipleAccountsUnknownDefault() throws Exception { - Settings.Builder builder = Settings.builder().put("xpack.notification.jira.default_account", "unknown"); - addAccountSettings("account1", builder); - addAccountSettings("account2", builder); - SettingsException e = expectThrows(SettingsException.class, () -> new JiraService(builder.build(), httpClient, clusterSettings) - ); - assertThat(e.getMessage(), is("could not find default account [unknown]")); - } - - public void testNoAccount() throws Exception { - Settings.Builder builder = Settings.builder(); - JiraService service = new JiraService(builder.build(), httpClient, clusterSettings); - - IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> service.getAccount(null)); - assertThat(e.getMessage(), is("no account found for name: [null]")); - } - - public void testNoAccountWithDefaultAccount() throws Exception { - Settings.Builder builder = Settings.builder().put("xpack.notification.jira.default_account", "unknown"); - - SettingsException e = expectThrows(SettingsException.class, () -> new JiraService(builder.build(), httpClient, clusterSettings) - ); - assertThat(e.getMessage(), is("could not find default account [unknown]")); - } - public void testUnsecureAccountUrl() throws Exception { Settings settings = Settings.builder().put("url", "http://localhost").put("user", "foo").put("password", "bar").build(); SettingsException e = expectThrows(SettingsException.class, () -> new JiraAccount("test", settings, null)); diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/slack/SlackAccountsTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/slack/SlackAccountsTests.java deleted file mode 100644 index 8320d3f242c..00000000000 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/slack/SlackAccountsTests.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -package org.elasticsearch.xpack.watcher.notification.slack; - -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.settings.SettingsException; -import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.watcher.common.http.HttpClient; -import org.elasticsearch.xpack.watcher.notification.slack.message.SlackMessageDefaultsTests; -import org.junit.Before; - -import java.util.Collections; - -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.isOneOf; -import static org.hamcrest.Matchers.notNullValue; -import static org.mockito.Mockito.mock; - -public class SlackAccountsTests extends ESTestCase { - private HttpClient httpClient; - - @Before - public void init() throws Exception { - httpClient = mock(HttpClient.class); - } - - public void testSingleAccount() throws Exception { - Settings.Builder builder = Settings.builder() - .put("xpack.notification.slack.default_account", "account1"); - addAccountSettings("account1", builder); - - SlackService service = new SlackService(builder.build(), httpClient, new ClusterSettings(Settings.EMPTY, - Collections.singleton(SlackService.SLACK_ACCOUNT_SETTING))); - SlackAccount account = service.getAccount("account1"); - assertThat(account, notNullValue()); - assertThat(account.name, equalTo("account1")); - account = service.getAccount(null); // falling back on the default - assertThat(account, notNullValue()); - assertThat(account.name, equalTo("account1")); - } - - public void testSingleAccountNoExplicitDefault() throws Exception { - Settings.Builder builder = Settings.builder(); - addAccountSettings("account1", builder); - - SlackService service = new SlackService(builder.build(), httpClient, new ClusterSettings(Settings.EMPTY, - Collections.singleton(SlackService.SLACK_ACCOUNT_SETTING))); - SlackAccount account = service.getAccount("account1"); - assertThat(account, notNullValue()); - assertThat(account.name, equalTo("account1")); - account = service.getAccount(null); // falling back on the default - assertThat(account, notNullValue()); - assertThat(account.name, equalTo("account1")); - } - - public void testMultipleAccounts() throws Exception { - Settings.Builder builder = Settings.builder() - .put("xpack.notification.slack.default_account", "account1"); - addAccountSettings("account1", builder); - addAccountSettings("account2", builder); - - SlackService service = new SlackService(builder.build(), httpClient, new ClusterSettings(Settings.EMPTY, - Collections.singleton(SlackService.SLACK_ACCOUNT_SETTING))); - SlackAccount account = service.getAccount("account1"); - assertThat(account, notNullValue()); - assertThat(account.name, equalTo("account1")); - account = service.getAccount("account2"); - assertThat(account, notNullValue()); - assertThat(account.name, equalTo("account2")); - account = service.getAccount(null); // falling back on the default - assertThat(account, notNullValue()); - assertThat(account.name, equalTo("account1")); - } - - public void testMultipleAccountsNoExplicitDefault() throws Exception { - Settings.Builder builder = Settings.builder() - .put("xpack.notification.slack.default_account", "account1"); - addAccountSettings("account1", builder); - addAccountSettings("account2", builder); - - SlackService service = new SlackService(builder.build(), httpClient, new ClusterSettings(Settings.EMPTY, - Collections.singleton(SlackService.SLACK_ACCOUNT_SETTING))); - SlackAccount account = service.getAccount("account1"); - assertThat(account, notNullValue()); - assertThat(account.name, equalTo("account1")); - account = service.getAccount("account2"); - assertThat(account, notNullValue()); - assertThat(account.name, equalTo("account2")); - account = service.getAccount(null); - assertThat(account, notNullValue()); - assertThat(account.name, isOneOf("account1", "account2")); - } - - public void testMultipleAccountsUnknownDefault() throws Exception { - Settings.Builder builder = Settings.builder() - .put("xpack.notification.slack.default_account", "unknown"); - addAccountSettings("account1", builder); - addAccountSettings("account2", builder); - try { - new SlackService(builder.build(), httpClient, new ClusterSettings(Settings.EMPTY, - Collections.singleton(SlackService.SLACK_ACCOUNT_SETTING))); - fail("Expected SettingsException"); - } catch (SettingsException e) { - assertThat(e.getMessage(), is("could not find default account [unknown]")); - } - } - - public void testNoAccount() throws Exception { - Settings.Builder builder = Settings.builder(); - SlackService service = new SlackService(builder.build(), httpClient, new ClusterSettings(Settings.EMPTY, - Collections.singleton(SlackService.SLACK_ACCOUNT_SETTING))); - try { - service.getAccount(null); - fail("no accounts are configured so trying to get the default account should throw an IllegalStateException"); - } catch (IllegalArgumentException e) { - assertThat(e.getMessage(), is("no account found for name: [null]")); - } - } - - public void testNoAccountWithDefaultAccount() throws Exception { - Settings.Builder builder = Settings.builder() - .put("xpack.notification.slack.default_account", "unknown"); - try { - new SlackService(builder.build(), httpClient, new ClusterSettings(Settings.EMPTY, - Collections.singleton(SlackService.SLACK_ACCOUNT_SETTING))); - fail("Expected SettingsException"); - } catch (SettingsException e) { - assertThat(e.getMessage(), is("could not find default account [unknown]")); - } - } - - private void addAccountSettings(String name, Settings.Builder builder) { - builder.put("xpack.notification.slack.account." + name + ".url", "https://hooks.slack.com/services/" + randomAlphaOfLength(50)); - Settings defaults = SlackMessageDefaultsTests.randomSettings(); - for (String setting : defaults.keySet()) { - builder.copy("xpack.notification.slack.message_defaults." + setting, setting, defaults); - } - } -} diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/WatcherMatchers.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/WatcherMatchers.java deleted file mode 100644 index 6fbaaaf8023..00000000000 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/WatcherMatchers.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -package org.elasticsearch.xpack.watcher.test; - -import org.elasticsearch.action.index.IndexRequest; -import org.hamcrest.Description; -import org.hamcrest.TypeSafeMatcher; -import org.mockito.Matchers; - -public final class WatcherMatchers { - - private WatcherMatchers() { - } - - public static IndexRequest indexRequest(String index, String type, String id) { - return Matchers.argThat(indexRequestMatcher(index, type, id)); - } - - public static IndexRequest indexRequest(String index, String type, String id, IndexRequest.OpType opType) { - return Matchers.argThat(indexRequestMatcher(index, type, id).opType(opType)); - } - - public static IndexRequest indexRequest(String index, String type, String id, Long version, IndexRequest.OpType opType) { - return Matchers.argThat(indexRequestMatcher(index, type, id).version(version).opType(opType)); - } - - public static IndexRequestMatcher indexRequestMatcher(String index, String type, String id) { - return new IndexRequestMatcher(index, type, id); - } - - public static class IndexRequestMatcher extends TypeSafeMatcher { - - private final String index; - private final String type; - private final String id; - private Long version; - private IndexRequest.OpType opType; - - private IndexRequestMatcher(String index, String type, String id) { - this.index = index; - this.type = type; - this.id = id; - } - - public IndexRequestMatcher version(long version) { - this.version = version; - return this; - } - - public IndexRequestMatcher opType(IndexRequest.OpType opType) { - this.opType = opType; - return this; - } - - @Override - protected boolean matchesSafely(IndexRequest request) { - if (!index.equals(request.index()) || !type.equals(request.type()) || !id.equals(request.id())) { - return false; - } - if (version != null && !version.equals(request.version())) { - return false; - } - if (opType != null && !opType.equals(request.opType())) { - return false; - } - return true; - } - - @Override - public void describeTo(Description description) { - description.appendText("is index request [" + index + "/" + type + "/" + id + "]"); - } - } -} diff --git a/plugin/src/test/resources/rest-api-spec/api/xpack.deprecation.info.json b/plugin/src/test/resources/rest-api-spec/api/xpack.migration.deprecations.json similarity index 92% rename from plugin/src/test/resources/rest-api-spec/api/xpack.deprecation.info.json rename to plugin/src/test/resources/rest-api-spec/api/xpack.migration.deprecations.json index cd4e3cac339..f639880f510 100644 --- a/plugin/src/test/resources/rest-api-spec/api/xpack.deprecation.info.json +++ b/plugin/src/test/resources/rest-api-spec/api/xpack.migration.deprecations.json @@ -1,5 +1,5 @@ { - "xpack.deprecation.info": { + "xpack.migration.deprecations": { "documentation": "http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html", "methods": [ "GET" ], "url": { diff --git a/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_model_snapshots.json b/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_model_snapshots.json index 4bb94546200..f820bf43562 100644 --- a/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_model_snapshots.json +++ b/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_model_snapshots.json @@ -21,11 +21,11 @@ }, "params": { "from": { - "type": "integer", + "type": "int", "description": "Skips a number of documents" }, "size": { - "type": "integer", + "type": "int", "description": "The default number of documents returned in queries as a string." }, "start": { diff --git a/plugin/src/test/resources/rest-api-spec/test/deprecation/10_basic.yml b/plugin/src/test/resources/rest-api-spec/test/deprecation/10_basic.yml index 705ca9f9692..dad0c3b08eb 100644 --- a/plugin/src/test/resources/rest-api-spec/test/deprecation/10_basic.yml +++ b/plugin/src/test/resources/rest-api-spec/test/deprecation/10_basic.yml @@ -7,7 +7,7 @@ setup: --- "Test Deprecations": - do: - xpack.deprecation.info: + xpack.migration.deprecations: index: "*" - length: { cluster_settings: 0 } - length: { node_settings: 0 } diff --git a/qa/multi-cluster-search-security/src/test/resources/rest-api-spec/test/multi_cluster/20_info.yml b/qa/multi-cluster-search-security/src/test/resources/rest-api-spec/test/multi_cluster/20_info.yml index d5d5edd96e3..cf374db6a3b 100644 --- a/qa/multi-cluster-search-security/src/test/resources/rest-api-spec/test/multi_cluster/20_info.yml +++ b/qa/multi-cluster-search-security/src/test/resources/rest-api-spec/test/multi_cluster/20_info.yml @@ -36,7 +36,7 @@ teardown: - do: headers: { Authorization: "Basic am9lOnMza3JpdA==" } - remote.info: {} + cluster.remote_info: {} - match: { my_remote_cluster.connected: true } - match: { my_remote_cluster.num_nodes_connected: 1} - match: { my_remote_cluster.max_connections_per_cluster: 1} @@ -69,7 +69,7 @@ teardown: - do: headers: { Authorization: "Basic am9lOnMza3JpdA==" } - remote.info: {} + cluster.remote_info: {} - set: { my_remote_cluster.http_addresses.0: remote_http } - match: { test_remote_cluster.http_addresses.0: $remote_http } diff --git a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/60_monitoring.yml b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/60_monitoring.yml index 7ada9b43e3c..fde86a8130a 100644 --- a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/60_monitoring.yml +++ b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/60_monitoring.yml @@ -6,6 +6,9 @@ setup: --- "Index monitoring data and search on the old cluster": + - skip: + version: " - 999" + reason: "AwaitsFix'ing, see x-pack-elasticsearch #2948" - do: xpack.monitoring.bulk: system_id: "kibana" diff --git a/transport-client/build.gradle b/transport-client/build.gradle index 92a786b6f31..48f2c2e838e 100644 --- a/transport-client/build.gradle +++ b/transport-client/build.gradle @@ -12,6 +12,7 @@ dependencies { // all of x-pack for now, and transport client will be going away in the future. compile "org.elasticsearch.plugin:x-pack-api:${version}" compile "org.elasticsearch.client:transport:${version}" + compile "org.elasticsearch:x-pack-client-api-objects:${version}" testCompile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}" testCompile "junit:junit:${versions.junit}" testCompile "org.hamcrest:hamcrest-all:${versions.hamcrest}" @@ -19,6 +20,10 @@ dependencies { dependencyLicenses.enabled = false +dependencyLicenses { + ignoreSha 'x-pack-client-api-objects' +} + forbiddenApisTest { // we don't use the core test-framework, no lucene classes present so we don't want the es-test-signatures to // be pulled in