[
  {
    "path": ".github/CODEOWNERS",
    "content": "# This file is used to define the code owners for the repository.\n# Each line is a file pattern followed by one or more GitHub usernames or team names.\n# For more information, see https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners\n# The code owners will be automatically requested for review when someone makes changes to the files they own.\n# All the modified files will be reviewed by dadoonet.\n*       @dadoonet\n"
  },
  {
    "path": ".github/dependabot.yml",
    "content": "version: 2\nupdates:\n# Enable version updates for Maven\n- package-ecosystem: maven\n  directory: \"/\"\n  schedule:\n    interval: daily\n    time: \"04:00\"\n  open-pull-requests-limit: 99\n  assignees:\n  - dadoonet\n  labels:\n  - update\n\n# Maintain dependencies for GitHub Actions\n- package-ecosystem: \"github-actions\"\n  directory: \"/.github/workflows\"\n  schedule:\n    interval: \"daily\"\n    time: \"04:00\"\n  open-pull-requests-limit: 99\n  assignees:\n  - dadoonet\n  labels:\n  - update\n"
  },
  {
    "path": ".github/mergify.yml",
    "content": "pull_request_rules:\n  - name: automatic merge on CI success and review\n    conditions:\n      - check-success=build\n      - \"#approved-reviews-by>=1\"\n    actions:\n      merge:\n        method: merge\n"
  },
  {
    "path": ".github/workflows/maven.yml",
    "content": "# This workflow will build a Java project with Maven\n# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven\n\nname: Build and Deploy the master branch\n\non:\n  push:\n    branches: [ master ]\n\njobs:\n  build:\n\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions/checkout@v5\n    - name: Set up JDK 17 and Maven Central Repository\n      uses: actions/setup-java@v5\n      with:\n        java-version: '17'\n        distribution: 'adopt'\n    - name: Cache Maven packages\n      uses: actions/cache@v4\n      with:\n        path: ~/.m2\n        key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}\n        restore-keys: ${{ runner.os }}-m2\n    - name: Build with Maven\n      run: mvn --batch-mode --update-snapshots verify\n\n  deploy:\n    needs: build\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions/checkout@v5\n    - name: Cache Maven packages\n      uses: actions/cache@v4\n      with:\n        path: ~/.m2\n        key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}\n        restore-keys: ${{ runner.os }}-m2\n    - name: Set up JDK 14 and Maven Central Repository\n      uses: actions/setup-java@v5\n      with:\n        java-version: '17'\n        distribution: 'adopt'\n        server-id: sonatype-nexus-snapshots\n        server-username: MAVEN_USERNAME\n        server-password: MAVEN_PASSWORD\n    - name: Deploy with Maven\n      run: mvn deploy -DskipTests\n      env:\n        MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}\n        MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}\n"
  },
  {
    "path": ".github/workflows/pr.yml",
    "content": "# This workflow will build a Java project with Maven\n# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven\n\nname: Build Pull Requests\n\non: [pull_request]\n\njobs:\n  build:\n\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions/checkout@v5\n    - name: Set up JDK 17 and Maven Central Repository\n      uses: actions/setup-java@v5\n      with:\n        java-version: '17'\n        distribution: 'adopt'\n    - name: Cache Maven packages\n      uses: actions/cache@v4\n      with:\n        path: ~/.m2\n        key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}\n        restore-keys: ${{ runner.os }}-m2\n    - name: Build with Maven\n      run: mvn --batch-mode --update-snapshots verify\n"
  },
  {
    "path": ".gitignore",
    "content": "/.project\n/.classpath\n/.settings\n/target\n*.iml\n*.idea\n"
  },
  {
    "path": ".mvn/jvm.config",
    "content": " -Xmx1024m -Xms1024m -Djava.awt.headless=true\n\n"
  },
  {
    "path": ".mvn/maven.config",
    "content": "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn\n"
  },
  {
    "path": "LICENSE",
    "content": "\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "NOTICE",
    "content": "Copyright (c) David Pilato - 2012 \n\nThis product includes software developed by The Apache Software\nFoundation (http://www.apache.org/).\n"
  },
  {
    "path": "README.md",
    "content": "# Spring factories for Elasticsearch\n\n**This project is now archived.** \n\nPlease use [Elasticsearch Beyonder](https://github.com/dadoonet/elasticsearch-beyonder/) \ninstead. Just inject an Elasticsearch Rest Client bean in your code and use the\n`ElasticsearchBeyonder` class to load your indices, templates... Something like:\n\n```java\nimport org.springframework.context.annotation.Bean;\n\npublic class MyApp {\n    @Bean\n    ElasticsearchClient client;\n\n    public void startBeyonder() {\n        ElasticsearchBeyonder.start(client);\n    }\n}\n```\n\n---\n\nWelcome to the Spring factories for [Elasticsearch](https://www.elastic.co/elasticsearch/) project.\n\nThe factory provides a [Java Rest Client for Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/)\nand automatically create index settings and templates based on what is found in the classpath:\n\n* `/es/_index_lifecycles/` for [index lifecycles policies](#index-lifecycles-policies)\n* `/es/INDEXNAME/_settings.json` for [index settings and mappings](#indices) for a given index `INDEXNAME`\n* `/es/INDEXNAME/_update_settings.json` to [update existing index settings and mappings](#indices) for a given index `INDEXNAME`\n* `/es/_component_templates/` for [component templates](#component-templates)\n* `/es/_index_templates/` for [index templates](#index-templates)\n* `/es/_pipelines/` for [ingest pipelines](#ingest-pipelines)\n* `/es/_aliases.json` for [aliases](#aliases)\n\n## Documentation\n\n* For 8.x elasticsearch versions, you are reading the latest documentation.\n* For 7.x elasticsearch versions, look at [es-7.x branch](https://github.com/dadoonet/spring-elasticsearch/tree/es-7.x).\n* For 6.x elasticsearch versions, look at [es-6.x branch](https://github.com/dadoonet/spring-elasticsearch/tree/es-6.x).\n* For 5.x elasticsearch versions, look at [es-5.x branch](https://github.com/dadoonet/spring-elasticsearch/tree/es-5.x).\n* For 2.x elasticsearch versions, look at [es-2.x branch](https://github.com/dadoonet/spring-elasticsearch/tree/es-2.x).\n* For 1.x elasticsearch versions, look at [es-1.4 branch](https://github.com/dadoonet/spring-elasticsearch/tree/es-1.4).\n* For 0.x elasticsearch versions, look at [0.x branch](https://github.com/dadoonet/spring-elasticsearch/tree/0.x).\n\n| spring-elasticsearch | elasticsearch | Spring | Release date |\n|:--------------------:|:-------------:|:------:|:------------:|\n|     8.7-SNAPSHOT     |     8.x       | 6.0.7  |              |\n|         7.1          |   7.0 - 7.x   | 5.3.15 |  2022-01-13  |\n|         7.0          |   7.0 - 7.x   | 5.3.8  |  2021-06-21  |\n|         6.7          |   6.7 - 6.x   | 5.1.3  |  2019-04-13  |\n|         6.2          |   6.0 - 6.x   | 5.1.3  |  2019-01-08  |\n|         6.1          |   6.0 - 6.x   | 5.0.7  |  2018-07-22  |\n|         6.0          |   6.0 - 6.x   | 5.0.3  |  2018-02-08  |\n|         5.0          |   5.0 - 5.x   | 4.3.10 |  2018-02-04  |\n|        2.2.0         |   2.0 - 2.4   | 4.2.3  |  2017-03-09  |\n|        2.1.0         |   2.0, 2.1    | 4.2.3  |  2015-11-25  |\n|        2.0.0         |      2.0      | 4.1.4  |  2015-10-25  |\n|        1.4.2         |     < 2.0     | 4.1.4  |  2015-03-03  |\n|        1.4.1         |      1.4      | 4.1.4  |  2015-02-28  |\n|        1.4.0         |      1.4      | 4.1.4  |  2015-01-03  |\n|        1.3.0         |      1.3      | 4.0.6  |  2014-09-01  |\n|        1.0.0         |      1.0      | 3.2.2  |  2014-02-14  |\n\n## Build Status\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/fr.pilato.spring/spring-elasticsearch/badge.svg?style=flat-square)](https://maven-badges.herokuapp.com/maven-central/fr.pilato.spring/spring-elasticsearch/)\n[![Build Status](https://github.com/dadoonet/spring-elasticsearch/actions/workflows/maven.yml/badge.svg)](https://github.com/dadoonet/spring-elasticsearch/actions/workflows/maven.yml)\n\n## Release notes\n\n### Changes in 8.7\n\n* Update to Spring 6.0.7\n* Update to Java 17 (needed by Spring 6)\n* Update to Beyonder 8.6\n* Provides now the new official [Java Rest Client for Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/)\n* Removed deprecated templates\n* Removed deprecated XML support\n* As a side effect of a previous removal (TransportClient), async initialization of the client has been removed.\n* Deprecated `setProperties(Properties)` method.\n* Add a wait for yellow health when creating a new index\n\n### Changes in 7.1\n\n* Update to Beyonder 7.16 which brings in support for index lifecycles. \nYou can add your index lifecycles policies in the `_index_lifecycles` dir.\n\n### Major (breaking) changes in 7.0\n\n* The `TransportClient` has been removed.\n\n* As in Elasticsearch 7.x, only one single type is supported, you need to provide the mapping within\n  the index settings ( `_settings.json` file). As a consequence:\n * `forceMapping` setting has been replaced by `forceIndex`.\n * `mappings` setting has been replaced by `indices`.\n * `mergeMapping` setting has been removed.\n\n* `forceTemplate` setting has been removed. A template should be always updated.\n\n* `_template` dir has been deprecated by `_templates` dir.\n\n## Getting Started\n\n### Maven dependency\n\nImport spring-elasticsearch in you project `pom.xml` file:\n\n```xml\n<dependency>\n  <groupId>fr.pilato.spring</groupId>\n  <artifactId>spring-elasticsearch</artifactId>\n  <version>8.7</version>\n</dependency>\n```\n\nIf you want to set a specific version of the Elasticsearch Java client, add it to your `pom.xml` file:\n\n```xml\n<dependencies>\n  <dependency>\n    <groupId>co.elastic.clients</groupId>\n    <artifactId>elasticsearch-java</artifactId>\n    <version>${elasticsearch.version}</version>\n  </dependency>\n  <dependency>\n    <groupId>org.elasticsearch.client</groupId>\n    <artifactId>elasticsearch-rest-client</artifactId>\n    <version>${elasticsearch.version}</version>\n  </dependency>\n</dependencies>\n```\n\nIf you want to try out the most recent SNAPSHOT version [deployed on Sonatype](https://oss.sonatype.org/content/repositories/snapshots/fr/pilato/spring/spring-elasticsearch/):\n\n```xml\n<dependency>\n  <groupId>fr.pilato.spring</groupId>\n  <artifactId>spring-elasticsearch</artifactId>\n  <version>8.8-SNAPSHOT</version>\n</dependency>\n```\n\nDon't forget to add if needed the following repository in your `pom.xml`:\n\n```xml\n<repositories>\n    <repository>\n        <id>oss-snapshots</id>\n        <name>Sonatype OSS Snapshots</name>\n        <url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>\n        <releases><enabled>false</enabled></releases>\n        <snapshots><enabled>true</enabled></snapshots>\n    </repository>\n</repositories>\n```\n\nIf you depend on an elasticsearch SNAPSHOT version, you need to add the following repository to your `pom.xml`:\n\n```xml\n<repositories>\n    <repository>\n        <id>elastic-snapshots</id>\n        <name>Elastic Snapshots</name>\n        <url>http://snapshots.elastic.co/maven/</url>\n        <releases><enabled>false</enabled></releases>\n        <snapshots><enabled>true</enabled></snapshots>\n    </repository>\n</repositories>\n```\n\n### Logger\n\nWe are using [slf4j](http://www.slf4j.org/) for logging but you have to provide the logging implementation\nyou want to use and bind it.\n\nFor example for this project we are using for tests [log4j2](http://logging.apache.org/log4j/). \nIf you want to do so, add to your `pom.xml`:\n\n```xml\n<dependencies>\n  <dependency>\n      <groupId>org.apache.logging.log4j</groupId>\n      <artifactId>log4j-api</artifactId>\n      <version>2.20.0</version>\n  </dependency>\n  <dependency>\n      <groupId>org.apache.logging.log4j</groupId>\n      <artifactId>log4j-slf4j2-impl</artifactId>\n      <version>2.20.0</version>\n  </dependency>\n  <dependency>\n      <groupId>org.apache.logging.log4j</groupId>\n      <artifactId>log4j-core</artifactId>\n      <version>2.20.0</version>\n  </dependency>\n</dependencies>\n```\n\n## Using Java Annotations\n\nLet's say you want to use Spring Java Annotations, here is a typical application you can build.\n\n`pom.xml`:\n\n```xml\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <groupId>fr.pilato.tests</groupId>\n    <artifactId>spring-elasticsearch-test</artifactId>\n    <version>1.0-SNAPSHOT</version>\n\n    <dependencies>\n        <dependency>\n            <groupId>fr.pilato.spring</groupId>\n            <artifactId>spring-elasticsearch</artifactId>\n            <version>8.7</version>\n        </dependency>\n    </dependencies>\n</project>\n```\n\n`App.java`:\n\n```java\npackage fr.pilato.tests;\n\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.context.annotation.AnnotationConfigApplicationContext;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\nimport org.springframework.stereotype.Component;\n\nimport java.io.IOException;\n\n@Component\npublic class RestApp {\n\n  @Configuration\n  public class AppConfig {\n    @Bean\n    public ElasticsearchClient esClient() {\n      ElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\n      factory.setEsNodes(new String[]{\"https://127.0.0.1:9200\"});\n      factory.setUsername(\"elastic\");\n      factory.setPassword(\"changeme\");\n      factory.afterPropertiesSet();\n      return factory.getObject();\n    }\n  }\n\n  @Autowired\n  private ElasticsearchClient client;\n\n  public static void main(String[] args) {\n    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();\n    context.scan(\"fr.pilato.tests\");\n    context.refresh();\n\n    RestApp p = context.getBean(RestApp.class);\n    p.run();\n\n    context.close();\n  }\n\n  private void run() {\n    // Run an advanced request\n    client.info();\n\n    // You still have access to the Low Level client\n    client.getLowLevel().performRequest(new Request(\"GET\", \"/\"));\n  }\n}\n```\n\n## Features\n\nThe factory provides a [Java Rest Client for Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/)\nand automatically create index settings and templates based on what is found in the classpath:\n\n* `/es/INDEXNAME/_settings.json` for [index settings and mappings](#indices) for a given index `INDEXNAME`\n* `/es/INDEXNAME/_update_settings.json` to [update existing index settings and mappings](#indices) for a given index `INDEXNAME`\n* `/es/_component_templates/` for [component templates](#component-templates)\n* `/es/_index_templates/` for [index templates](#index-templates)\n* `/es/_pipelines/` for [ingest pipelines](#ingest-pipelines)\n* `/es/_aliases.json` for [aliases](#aliases)\n* `/es/_index_lifecycles/` for [index lifecycles policies](#index-lifecycles-policies)\n\n### Autoscan\n\nBy default, the factory will scan the classpath inside the default `/es` directory.\nYou can disable the autoscan and then provide manually every name for indices, templates...\n\n```java\nElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\nfactory.setAutoscan(false);\nfactory.setIndices(new String[]{\"twitter\"});\n```\n\n### Default directory\n\nYou can change the default directory from `/es` to something else. The factory will look into this\ndirectory to find the indices and the settings for the indices, templates...\n\n```java\nElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\nfactory.setClasspathRoot(\"/foo\");\n```\n\n### Indices\n\nIf you add in your classpath a file named `/es/twitter/_settings.json`, it will be automatically applied to define\nsettings for your `twitter` index.\n\nFor example, create the following file `src/main/resources/es/twitter/_settings.json` in your project:\n\n```json\n{\n  \"settings\" : {\n    \"number_of_shards\" : 3,\n    \"number_of_replicas\" : 2\n  },\n  \"mappings\": {\n    \"properties\" : {\n      \"message\" : {\"type\" : \"text\", \"store\" : \"yes\"}\n    }\n  }\n}\n```\n\nIf you need to update settings for an existing index, let say `twitter`, add a file named  `/es/twitter/_update_settings.json` \nin your classpath. The factory will detect it and will try to update the settings:\n\n```json\n{\n  \"index\" : {\n    \"number_of_replicas\" : 1\n  }\n}\n```\n\nIf you want to remove the existing indices every time the factory starts, you can use the `forceIndex` option:\n\n```java\nElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\n// Be careful: IT WILL REMOVE ALL EXISTING DATA FOR THE MANAGED INDICES.\nfactory.setForceIndex(true);\n```\n\nBe careful: **IT WILL REMOVE ALL EXISTING DATA** FOR THE MANAGED INDICES.\n\n\n### Component templates\n\nThis feature will call the [Component Templates APIs](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-component-template.html).\nIt's very common to use it with [index templates](#index-templates).\n\nLet say you want to create a component template named `component1`. Just create a file named\n`/es/_component_templates/component1.json`:\n\n```json\n{\n  \"template\": {\n    \"mappings\": {\n      \"properties\": {\n        \"@timestamp\": {\n          \"type\": \"date\"\n        }\n      }\n    }\n  }\n}\n```\n\nLet say you want to create a component template named `component2`. Just create a file named\n`/es/_component_templates/component2.json`:\n\n```json\n{\n  \"template\": {\n    \"mappings\": {\n      \"runtime\": {\n        \"day_of_week\": {\n          \"type\": \"keyword\",\n          \"script\": {\n            \"source\": \"emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))\"\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nYou can use then the 2 component templates in an index template as shown below.\n\n### Index templates\n\nThis feature will call the [Index Templates APIs](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-templates.html).\nIt can be used with [component templates](#component-templates).\n\nLet say you want to create an index template named `template_1`. Just create a file named \n`/es/_index_templates/template_1.json`:\n\n```json\n{\n  \"index_patterns\": [\"te*\", \"bar*\"],\n  \"template\": {\n    \"settings\": {\n      \"number_of_shards\": 1\n    },\n    \"mappings\": {\n      \"_source\": {\n        \"enabled\": true\n      },\n      \"properties\": {\n        \"host_name\": {\n          \"type\": \"keyword\"\n        },\n        \"created_at\": {\n          \"type\": \"date\",\n          \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n        }\n      }\n    },\n    \"aliases\": {\n      \"mydata\": { }\n    }\n  },\n  \"priority\": 500,\n  \"composed_of\": [\"component1\", \"component2\"],\n  \"version\": 3,\n  \"_meta\": {\n    \"description\": \"my custom\"\n  }\n}\n```\n\nNote that this index template is using the 2 component templates that have been defined in the previous section.\n\n### Aliases\n\nAn alias is helpful to define or remove an alias to a given index. You could also use an [index templates](#index-templates)\nto do that automatically when at index creation time, but you can also define a file `/es/_aliases.json`:\n\n```json\n{\n  \"actions\" : [\n    { \"remove\": { \"index\": \"test_1\", \"alias\": \"test\" } },\n    { \"add\":  { \"index\": \"test_2\", \"alias\": \"test\" } }\n  ]\n}\n```\n\nWhen the factory starts, it will automatically send the content to the [Aliases API](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html)\nand move the alias `test` from index `test_1` to index `test_2`.\n\n### Ingest Pipelines\n\nThis feature will call the [Ingest Pipelines APIs](https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest.html)\n\nLet say you want to create an ingest pipeline named `pipeline1`. Just create a file named\n`/es/_pipeline/pipeline1.json`:\n\n```json\n{\n  \"description\": \"My optional pipeline description\",\n  \"processors\": [\n    {\n      \"set\": {\n        \"description\": \"My optional processor description\",\n        \"field\": \"my-long-field\",\n        \"value\": 10\n      }\n    },\n    {\n      \"set\": {\n        \"description\": \"Set 'my-boolean-field' to true\",\n        \"field\": \"my-boolean-field\",\n        \"value\": true\n      }\n    },\n    {\n      \"lowercase\": {\n        \"field\": \"my-keyword-field\"\n      }\n    }\n  ]\n}\n```\n\n### Index Lifecycles Policies\n\nThis feature will call the [Index Lifecycle APIs](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-lifecycle-management.html).\n\nLet say you want to create a policy named `policy1`. Just create a file named\n`/es/_index_lifecycles/policy1.json`:\n\n```json\n{\n  \"policy\": {\n    \"phases\": {\n      \"warm\": {\n        \"min_age\": \"10d\",\n        \"actions\": {\n          \"forcemerge\": {\n            \"max_num_segments\": 1\n          }\n        }\n      },\n      \"delete\": {\n        \"min_age\": \"30d\",\n        \"actions\": {\n          \"delete\": {}\n        }\n      }\n    }\n  }\n}\n```\n\nIt will be automatically loaded into elasticsearch when you start the factory.\nIf you want to apply this policy to your index, you can define the following settings for the index in\n`/es/twitter/_settings.json`:\n\n```json\n{\n\t\"settings\" : {\n\t\t\"index.lifecycle.name\": \"policy1\"\n\t}\n}\n```\n\n### SSL certificates\n\nIf you need to specify your own SSL certificates (self-signed certificates), you can use the `setSSLContext(SSLContext)`\nmethod to do this.\nYou can refer to the Elasticsearch [Low Level client documentation](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/_encrypted_communication.html)\nto see some examples. Once you have created a SSLContext, you can use it in the factory:\n\n```java\nPath trustStorePath = Paths.get(\"/path/to/truststore.p12\");\nKeyStore truststore = KeyStore.getInstance(\"pkcs12\");\ntry (InputStream is = Files.newInputStream(trustStorePath)) {\n    truststore.load(is, keyStorePass.toCharArray());\n}\nSSLContextBuilder sslBuilder = SSLContexts.custom().loadTrustMaterial(truststore, null);\nfinal SSLContext sslContext = sslBuilder.build();\n\nElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\nfactory.setSslContext(sslContext);\n```\n\n# Thanks\n\nSpecial thanks to\n\n- [Nicolas Huray](https://github.com/nhuray) for his contribution about\n[templates](https://github.com/dadoonet/spring-elasticsearch/pull/4)\n- [Nicolas Labrot](https://github.com/nithril) for his contribution about\n[async](https://github.com/dadoonet/spring-elasticsearch/pull/30)\n\n# Running tests\n\nIf you want to run tests (integration tests) from your IDE, you need to start first an elasticsearch instance.\nTests are expecting a node running at `https://localhost:9200` with the user `elastic` and `changeme` as the password.\n\nTo run the tests using Maven (on the CLI), just run:\n\n```sh\nmvn clean install\n```\n\nYou can change the target to run the tests. For example, if you want to run the tests against an elastic cloud instance:\n\n```shell\nmvn clean install -Dtests.cluster=https://ID.es.ZONE.PROVIDER.cloud.es.io -Dtests.cluster.user=myuser -Dtests.cluster.pass=YOURPASSWORD\n```\n\n# Release guide\n\nTo release the project you need to run the release plugin with the `release` profile as you need to sign the artifacts:\n\n```sh\nmvn release:prepare\ngit push --tags\ngit push\nmvn release:perform -Prelease\n```\n\nIf you need to skip the tests, run:\n\n```sh\nmvn release:perform -Prelease -Darguments=\"-DskipTests\"\n```\n\nIf everything is ok in https://s01.oss.sonatype.org/#stagingRepositories, you can perform the release with:\n\n```sh\nmvn nexus-staging:release\nmvn nexus-staging:drop\n```\n\nTo announce the release, run:\n\n```sh\ncd target/checkout\n# Run the following command if you want to check the announcement email\nmvn changes:announcement-generate\ncat target/announcement/announcement.vm\n\n# Announce the release (change your smtp username and password)\nmvn changes:announcement-mail -Dchanges.username='YourSmtpUserName' -Dchanges.password='YourSmtpUserPassword'\n```\n\n# License\n\nThis software is licensed under the Apache 2 license, quoted below.\n\n\tCopyright 2011-2023 David Pilato\n\t\n\tLicensed under the Apache License, Version 2.0 (the \"License\"); you may not\n\tuse this file except in compliance with the License. You may obtain a copy of\n\tthe License at\n\t\n\t    http://www.apache.org/licenses/LICENSE-2.0\n\t\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n\tWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n\tLicense for the specific language governing permissions and limitations under\n\tthe License.\n"
  },
  {
    "path": "pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n    <modelVersion>4.0.0</modelVersion>\n    <groupId>fr.pilato.spring</groupId>\n    <artifactId>spring-elasticsearch</artifactId>\n    <packaging>jar</packaging>\n    <name>spring-elasticsearch</name>\n    <version>8.7-SNAPSHOT</version>\n    <url>https://github.com/dadoonet/spring-elasticsearch</url>\n    <description>Spring factories for Elasticsearch</description>\n\n    <licenses>\n        <license>\n            <name>The Apache Software License, Version 2.0</name>\n            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>\n            <distribution>repo</distribution>\n        </license>\n    </licenses>\n\n    <properties>\n        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>\n        <java.compiler.version>17</java.compiler.version>\n\n        <spring.version>6.2.11</spring.version>\n        <elasticsearch.version>8.11.0</elasticsearch.version>\n        <beyonder.version>8.6-SNAPSHOT</beyonder.version>\n        <slf4j.version>2.0.17</slf4j.version>\n        <log4j.version>2.25.1</log4j.version>\n        <commons.io.version>2.20.0</commons.io.version>\n        <jackson.version>2.20.0</jackson.version>\n        <junit.version>5.13.4</junit.version>\n\n        <skipTests>false</skipTests>\n        <skip.unit.tests>${skipTests}</skip.unit.tests>\n        <skip.integration.tests>${skipTests}</skip.integration.tests>\n        <tests.cluster.username>elastic</tests.cluster.username>\n        <tests.cluster.password>changeme</tests.cluster.password>\n        <tests.cluster.credentials>${tests.cluster.username}:${tests.cluster.password}</tests.cluster.credentials>\n\n        <!-- For integration tests using Docker or external cluster -->\n        <integ.elasticsearch.image>docker.elastic.co/elasticsearch/elasticsearch</integ.elasticsearch.image>\n        <integ.elasticsearch.version>${elasticsearch.version}</integ.elasticsearch.version>\n        <tests.cluster.rest.port>9200</tests.cluster.rest.port>\n        <tests.cluster.transport.port>9300</tests.cluster.transport.port>\n\n        <!-- Smtp Settings for announcements -->\n        <changes.smtpHost>smtp.ionos.fr</changes.smtpHost>\n        <changes.smtpPort implementation=\"java.lang.Integer\">465</changes.smtpPort>\n    </properties>\n\n    <distributionManagement>\n        <snapshotRepository>\n            <id>sonatype-nexus-snapshots</id>\n            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>\n        </snapshotRepository>\n        <repository>\n            <id>sonatype-nexus-staging</id>\n            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>\n        </repository>\n    </distributionManagement>\n\n    <developers>\n        <developer>\n            <id>dadoonet</id>\n            <name>David Pilato</name>\n            <email>david@pilato.fr</email>\n            <url>http://david.pilato.fr/</url>\n            <timezone>+1</timezone>\n        </developer>\n        <developer>\n            <id>nhuray</id>\n            <name>Nicolas Huray</name>\n            <url>https://github.com/nhuray/</url>\n            <timezone>+1</timezone>\n        </developer>\n        <developer>\n            <id>nlabrot</id>\n            <name>Nicolas Labrot</name>\n            <url>https://github.com/nithril‎/</url>\n            <timezone>Europe/Paris</timezone>\n        </developer>\n    </developers>\n\n    <scm>\n        <url>scm:git:git@github.com:dadoonet/spring-elasticsearch.git</url>\n        <connection>scm:git:git@github.com:dadoonet/spring-elasticsearch.git</connection>\n        <developerConnection>scm:git:git@github.com:dadoonet/spring-elasticsearch.git</developerConnection>\n      <tag>HEAD</tag>\n    </scm>\n\n    <issueManagement>\n        <system>GitHub</system>\n        <url>https://github.com/dadoonet/spring-elasticsearch/issues/</url>\n    </issueManagement>\n\n    <repositories>\n        <repository>\n            <id>elastic-download-service</id>\n            <name>Elastic Download Service</name>\n            <url>https://artifacts.elastic.co/maven/</url>\n            <releases><enabled>true</enabled></releases>\n            <snapshots><enabled>false</enabled></snapshots>\n        </repository>\n\n        <repository>\n            <id>elastic-snapshots</id>\n            <name>Elastic Snapshots</name>\n            <url>https://snapshots.elastic.co/maven/</url>\n            <releases><enabled>false</enabled></releases>\n            <snapshots><enabled>true</enabled></snapshots>\n        </repository>\n\n        <repository>\n            <id>oss-snapshots</id>\n            <name>Sonatype OSS Snapshots</name>\n            <url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>\n            <releases><enabled>false</enabled></releases>\n            <snapshots><enabled>true</enabled></snapshots>\n        </repository>\n    </repositories>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.hamcrest</groupId>\n            <artifactId>hamcrest-all</artifactId>\n            <version>1.3</version>\n            <scope>test</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.springframework</groupId>\n            <artifactId>spring-core</artifactId>\n            <version>${spring.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.springframework</groupId>\n            <artifactId>spring-beans</artifactId>\n            <version>${spring.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.springframework</groupId>\n            <artifactId>spring-context</artifactId>\n            <version>${spring.version}</version>\n        </dependency>\n\n        <!-- Logging dependencies -->\n        <dependency>\n            <groupId>org.slf4j</groupId>\n            <artifactId>slf4j-api</artifactId>\n            <version>${slf4j.version}</version>\n        </dependency>\n\n        <!-- LOG4J2 implementation is optional -->\n        <dependency>\n            <groupId>org.apache.logging.log4j</groupId>\n            <artifactId>log4j-api</artifactId>\n            <version>${log4j.version}</version>\n            <optional>true</optional>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.logging.log4j</groupId>\n            <artifactId>log4j-slf4j2-impl</artifactId>\n            <version>${log4j.version}</version>\n            <optional>true</optional>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.logging.log4j</groupId>\n            <artifactId>log4j-core</artifactId>\n            <version>${log4j.version}</version>\n            <optional>true</optional>\n        </dependency>\n\n        <!-- Elasticsearch -->\n        <dependency>\n            <groupId>co.elastic.clients</groupId>\n            <artifactId>elasticsearch-java</artifactId>\n            <version>${elasticsearch.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.elasticsearch.client</groupId>\n            <artifactId>elasticsearch-rest-client</artifactId>\n            <version>${elasticsearch.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>fr.pilato.elasticsearch</groupId>\n            <artifactId>elasticsearch-beyonder</artifactId>\n            <version>${beyonder.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>commons-io</groupId>\n            <artifactId>commons-io</artifactId>\n            <version>${commons.io.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.springframework</groupId>\n            <artifactId>spring-test</artifactId>\n            <version>${spring.version}</version>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.junit.jupiter</groupId>\n            <artifactId>junit-jupiter-api</artifactId>\n            <version>${junit.version}</version>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.junit.jupiter</groupId>\n            <artifactId>junit-jupiter-engine</artifactId>\n            <version>${junit.version}</version>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>cglib</groupId>\n            <artifactId>cglib</artifactId>\n            <version>3.3.0</version>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>com.fasterxml.jackson.core</groupId>\n            <artifactId>jackson-core</artifactId>\n            <version>${jackson.version}</version>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>com.fasterxml.jackson.core</groupId>\n            <artifactId>jackson-databind</artifactId>\n            <version>${jackson.version}</version>\n            <scope>test</scope>\n        </dependency>\n\n    </dependencies>\n\n    <build>\n        <plugins>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-help-plugin</artifactId>\n                <version>3.5.1</version>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-resources-plugin</artifactId>\n                <version>3.3.1</version>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-compiler-plugin</artifactId>\n                <version>3.14.1</version>\n                <configuration>\n                    <source>${java.compiler.version}</source>\n                    <target>${java.compiler.version}</target>\n                    <encoding>UTF-8</encoding>\n                    <optimize>true</optimize>\n                    <showDeprecation>true</showDeprecation>\n                    <showWarnings>true</showWarnings>\n                    <compilerArgument>-Xlint:all,-serial,-path,-rawtypes,-unchecked</compilerArgument>\n                </configuration>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-dependency-plugin</artifactId>\n                <version>3.8.1</version>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-enforcer-plugin</artifactId>\n                <version>3.6.1</version>\n                <configuration>\n                    <rules>\n                        <requireJavaVersion>\n                            <version>${java.compiler.version}</version>\n                        </requireJavaVersion>\n                    </rules>\n                </configuration>\n            </plugin>\n            <plugin>\n                <groupId>org.sonatype.plugins</groupId>\n                <artifactId>nexus-staging-maven-plugin</artifactId>\n                <version>1.6.13</version>\n                <extensions>true</extensions>\n                <configuration>\n                    <serverId>sonatype-nexus-staging</serverId>\n                    <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>\n                    <autoReleaseAfterClose>false</autoReleaseAfterClose>\n                </configuration>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-jar-plugin</artifactId>\n                <version>3.4.2</version>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-scm-plugin</artifactId>\n                <version>2.1.0</version>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-changes-plugin</artifactId>\n                <version>2.12.1</version>\n                <configuration>\n                    <sslMode>true</sslMode>\n                    <fromDeveloperId>dadoonet</fromDeveloperId>\n                    <toAddresses>\n                        <toAddress implementation=\"java.lang.String\">discuss+community-plugins@elastic.co</toAddress>\n                    </toAddresses>\n                    <issueManagementSystems>\n                        <issueManagementSystem>GitHub</issueManagementSystem>\n                    </issueManagementSystems>\n                    <issueTypes>\n                        <add>new,doc</add>\n                        <fix>bug</fix>\n                        <update>update</update>\n                        <remove>remove</remove>\n                    </issueTypes>\n                    <onlyCurrentVersion>true</onlyCurrentVersion>\n                    <urlDownload>\n                        https://repo1.maven.org/maven2/fr/pilato/spring/spring-elasticsearch/${project.version}/\n                    </urlDownload>\n                </configuration>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-release-plugin</artifactId>\n                <version>3.1.1</version>\n                <configuration>\n                    <pushChanges>false</pushChanges>\n                </configuration>\n            </plugin>\n            <!-- For IT using Docker -->\n            <plugin>\n                <groupId>io.fabric8</groupId>\n                <artifactId>docker-maven-plugin</artifactId>\n                <version>0.46.0</version>\n                <configuration>\n                    <images>\n                        <image>\n                            <alias>spring-elasticsearch</alias>\n                            <name>dadoonet/spring-elasticsearch:${project.version}</name>\n                            <build>\n                                <from>${integ.elasticsearch.image}:${integ.elasticsearch.version}</from>\n                                <env>\n                                    <discovery.type>single-node</discovery.type>\n                                    <ELASTIC_PASSWORD>${tests.cluster.password}</ELASTIC_PASSWORD>\n                                </env>\n                            </build>\n                            <run>\n                                <ports>\n                                    <port>tests.cluster.rest.port:9200</port>\n                                </ports>\n                                <wait>\n                                    <http>\n                                        <url>https://localhost:${tests.cluster.rest.port}/</url>\n                                        <status>200..499</status>\n                                        <allowAllHosts>true</allowAllHosts>\n                                    </http>\n                                    <time>60000</time>\n                                </wait>\n                            </run>\n                        </image>\n                    </images>\n                    <skip>${skip.integration.tests}</skip>\n                </configuration>\n                <executions>\n                    <execution>\n                        <id>start-elasticsearch</id>\n                        <phase>pre-integration-test</phase>\n                        <goals>\n                            <goal>build</goal>\n                            <goal>stop</goal>\n                            <goal>start</goal>\n                        </goals>\n                    </execution>\n                    <execution>\n                        <id>stop-elasticsearch</id>\n                        <phase>post-integration-test</phase>\n                        <goals>\n                            <goal>stop</goal>\n                        </goals>\n                    </execution>\n                </executions>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-surefire-plugin</artifactId>\n                <version>3.5.4</version>\n                <configuration>\n                    <!-- Skips unit tests if the value of skip.unit.tests property is true -->\n                    <skipTests>${skip.unit.tests}</skipTests>\n                    <!-- Excludes integration tests when unit tests are run -->\n                    <excludes>\n                        <exclude>**/it/**/*Test.java</exclude>\n                    </excludes>\n                </configuration>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-failsafe-plugin</artifactId>\n                <version>3.5.4</version>\n                <dependencies>\n                    <!-- Workaround for https://issues.apache.org/jira/browse/SUREFIRE-1732\n                     TODO remove with next version of failsafe plugin\n                     -->\n                    <dependency>\n                        <groupId>org.apache.maven.surefire</groupId>\n                        <artifactId>surefire-api</artifactId>\n                        <version>3.5.4</version>\n                    </dependency>\n                </dependencies>\n                <executions>\n                    <!--\n                        Invokes both the integration-test and the verify goals of the\n                        Failsafe Maven plugin\n                    -->\n                    <execution>\n                        <id>integration-tests</id>\n                        <goals>\n                            <goal>integration-test</goal>\n                            <goal>verify</goal>\n                        </goals>\n                        <configuration>\n                            <!--\n                                Skips integration tests if the value of skip.integration.tests\n                                property is true\n                            -->\n                            <skipTests>${skip.integration.tests}</skipTests>\n                            <!-- Excludes integration tests when unit tests are run -->\n                            <includes>\n                                <include>**/it/**/*Test.java</include>\n                            </includes>\n                        </configuration>\n                    </execution>\n                </executions>\n            </plugin>\n        </plugins>\n        <testResources>\n            <testResource>\n                <directory>src/test/resources</directory>\n                <filtering>true</filtering>\n            </testResource>\n        </testResources>\n    </build>\n\n    <profiles>\n        <profile>\n            <id>release</id>\n            <build>\n                <plugins>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-javadoc-plugin</artifactId>\n                        <version>3.12.0</version>\n                        <executions>\n                            <execution>\n                                <id>attach-javadocs</id>\n                                <goals>\n                                    <goal>jar</goal>\n                                </goals>\n                            </execution>\n                        </executions>\n                    </plugin>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-source-plugin</artifactId>\n                        <version>3.3.1</version>\n                        <executions>\n                            <execution>\n                                <id>attach-sources</id>\n                                <goals>\n                                    <goal>jar-no-fork</goal>\n                                </goals>\n                            </execution>\n                        </executions>\n                    </plugin>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-gpg-plugin</artifactId>\n                        <version>3.2.8</version>\n                        <executions>\n                            <execution>\n                                <id>sign-artifacts</id>\n                                <phase>verify</phase>\n                                <goals>\n                                    <goal>sign</goal>\n                                </goals>\n                            </execution>\n                        </executions>\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>\n    </profiles>\n\n</project>\n"
  },
  {
    "path": "src/main/java/fr/pilato/spring/elasticsearch/ElasticsearchClientFactoryBean.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport co.elastic.clients.elasticsearch._types.HealthStatus;\nimport co.elastic.clients.json.jackson.JacksonJsonpMapper;\nimport co.elastic.clients.transport.ElasticsearchTransport;\nimport co.elastic.clients.transport.rest_client.RestClientTransport;\nimport fr.pilato.elasticsearch.tools.util.ResourceList;\nimport fr.pilato.elasticsearch.tools.util.SettingsFinder;\nimport org.apache.http.HttpHost;\nimport org.apache.http.auth.AuthScope;\nimport org.apache.http.auth.UsernamePasswordCredentials;\nimport org.apache.http.client.CredentialsProvider;\nimport org.apache.http.impl.client.BasicCredentialsProvider;\nimport org.elasticsearch.client.RestClient;\nimport org.elasticsearch.client.RestClientBuilder;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.springframework.beans.factory.DisposableBean;\nimport org.springframework.beans.factory.FactoryBean;\nimport org.springframework.beans.factory.InitializingBean;\nimport org.springframework.util.Assert;\n\nimport javax.net.ssl.SSLContext;\nimport java.io.IOException;\nimport java.net.URISyntaxException;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Properties;\n\nimport static fr.pilato.elasticsearch.tools.updaters.ElasticsearchAliasUpdater.manageAliases;\nimport static fr.pilato.elasticsearch.tools.updaters.ElasticsearchAliasUpdater.manageAliasesWithJsonInElasticsearch;\nimport static fr.pilato.elasticsearch.tools.updaters.ElasticsearchComponentTemplateUpdater.createComponentTemplate;\nimport static fr.pilato.elasticsearch.tools.updaters.ElasticsearchIndexLifecycleUpdater.createIndexLifecycle;\nimport static fr.pilato.elasticsearch.tools.updaters.ElasticsearchIndexTemplateUpdater.createIndexTemplate;\nimport static fr.pilato.elasticsearch.tools.updaters.ElasticsearchIndexUpdater.createIndex;\nimport static fr.pilato.elasticsearch.tools.updaters.ElasticsearchIndexUpdater.updateSettings;\nimport static fr.pilato.elasticsearch.tools.updaters.ElasticsearchPipelineUpdater.createPipeline;\nimport static fr.pilato.elasticsearch.tools.util.ResourceList.findIndexNames;\n\n/**\n * An abstract {@link FactoryBean} used to create an Elasticsearch\n * {@link ElasticsearchClient}.\n * <p>\n * The lifecycle of the underlying {@link ElasticsearchClient} instance is tied to the\n * lifecycle of the bean via the {@link #destroy()} method which calls\n * {@link RestClient#close()}\n * </p>\n * <p>\n * If not using the default https://localhost:9200, you need to define the nodes you want to communicate with\n * and probably the credentials.\n * </p>\n * <p>Example :</p>\n * <pre>\n * {@code\n * @Configuration\n * public class AppConfig {\n *    @Bean\n *    public ElasticsearchClient esClient() throws Exception {\n * \t\tElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\n * \t    factory.setEsNodes(List.of(HttpHost.create(\"https://localhost:9200\")));\n * \t\tfactory.setPassword(\"changeme\");\n * \t\tfactory.afterPropertiesSet();\n * \t\treturn factory.getObject();\n *    }\n *  }\n * }\n * </pre>\n * <p>\n * The factory is meant to be used with some classpath files which are automatically\n * loaded from {@code /es} directory to define your:\n * <ul>\n *   <li>component templates: {@code /es/_component_templates/*.json}\n *   <li>index templates: {@code /es/_index_templates/*.json}\n *   <li>indices: {@code /es/INDEXNAME/_settings.json}\n *   <li>aliases: {@code /es/_aliases.json}\n *   <li>index lifecycles policies: {@code /es/_index_lifecycles/*.json}\n *   <li>ingest pipelines: {@code /es/_pipelines/*.json}\n * </ul>\n *\n * <p>You can force the manual creation of the above components but this is\n * not the goal of this factory. So it should be used only for some specific use cases:\n * </p>\n * <p>\n * Example :\n * </p>\n * <pre>\n * {@code\n * @Configuration\n * public class AppConfig {\n *    @Bean\n *    public ElasticsearchClient esClient() throws Exception {\n *      ElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\n * \t    // Create two indices twitter and rss\n * \t    factory.setIndices(new String[]{ \"twitter\", \"rss\" });\n * \t    // Create an alias alltheworld on top of twitter and rss indices\n * \t    factory.setAliases(new String[]{ \"alltheworld:twitter\", \"alltheworld:rss\" });\n * \t    // Remove all the existing declared indices (twitter and rss). VERY DANGEROUS SETTING!\n * \t    factory.setForceIndex(true);\n * \t    // If setForceIndex is not set, we try to merge existing index settings\n * \t    // with the provided ones\n * \t    factory.setMergeSettings(true);\n * \t    // Disable automatic scanning of the classpath.\n * \t    factory.setAutoscan(false);\n *      factory.afterPropertiesSet();\n *      return factory.getObject();\n *    }\n *  }\n * }\n * </pre>\n * By default, indexes are created with their default Elasticsearch settings. You can specify\n * your own settings for your index by putting a /es/indexname/_settings.json in your classpath.\n * <br>\n * So if you create a file named /es/twitter/_settings.json in your src/main/resources folder (for maven lovers),\n * it will be used by the factory to create the twitter index.\n * <pre>\n {\n  \"settings\" : {\n   \"number_of_shards\" : 3,\n   \"number_of_replicas\" : 2\n  },\n  \"mappings\" : {\n   \"properties\" : {\n    \"message\" : {\"type\" : \"text\"}\n   }\n  }\n }\n * </pre>\n *\n * By convention, the factory will create all settings found under the /es classpath.<br>\n * You can disable convention and use configuration by setting autoscan to false.\n *\n * @see ElasticsearchClient\n * @author David Pilato\n */\npublic class ElasticsearchClientFactoryBean\n        implements FactoryBean<ElasticsearchClient>, InitializingBean, DisposableBean {\n\n    private static final Logger logger = LoggerFactory.getLogger(ElasticsearchClientFactoryBean.class);\n\n    /**\n     * Define the username:password to use.\n     * @deprecated Now deprecated with username and password settings.\n     * @see ElasticsearchClientFactoryBean#setUsername(String)\n     * @see ElasticsearchClientFactoryBean#setPassword(String)\n     */\n    @Deprecated\n    public final static String XPACK_USER = \"xpack.security.user\";\n\n    private RestClient lowLevelClient;\n\n    private boolean forceIndex;\n\n    private boolean mergeSettings = true;\n\n    private boolean autoscan = true;\n\n    private String username;\n    private String password;\n\n    // TODO add support for keys\n\n    @Deprecated\n    private String[] indices;\n\n    @Deprecated\n    private String[] aliases;\n\n    @Deprecated\n    private String[] componentTemplates;\n\n    @Deprecated\n    private String[] indexTemplates;\n\n    @Deprecated\n    private String[] pipelines;\n\n    @Deprecated\n    private String[] lifecycles;\n\n    private String classpathRoot = \"es\";\n\n    private Collection<HttpHost> esNodes = List.of(HttpHost.create(\"https://localhost:9200\"));\n\n    private ElasticsearchClient client;\n\n    private SSLContext sslContext;\n\n    public RestClient getLowLevelClient() {\n        return lowLevelClient;\n    }\n\n    /**\n     * Elasticsearch properties\n     * @param properties the properties\n     * @deprecated it was only used to set xpack.security.user. Please use now {@link #setUsername(String)}\n     * and {@link #setPassword(String)}.\n     */\n    @Deprecated\n    public void setProperties(Properties properties) {\n        String securedUser = properties.getProperty(XPACK_USER, null);\n        if (securedUser != null) {\n            logger.warn(\"Usage of xpack.security.user property has been deprecated. \" +\n                    \"You should now use username and password factory settings.\");\n\n            // We split the username and the password\n            String[] split = securedUser.split(\":\");\n            if (split.length < 2) {\n                throw new IllegalArgumentException(XPACK_USER + \" must have the form username:password\");\n            }\n            username = split[0];\n            password = split[1];\n        }\n    }\n\n    /**\n     * Set to true if you want to force reinit the indices. This will remove all existing indices managed by the factory.\n     * @param forceIndex true if you want to force reinit the indices\n     */\n    public void setForceIndex(boolean forceIndex) {\n        this.forceIndex = forceIndex;\n    }\n\n    /**\n     * Set to true if you want to try to merge index settings\n     * @param mergeSettings true if you want to try to merge index settings\n     */\n    public void setMergeSettings(boolean mergeSettings) {\n        this.mergeSettings = mergeSettings;\n    }\n\n    /**\n     * Set to false if you want to use configuration instead of convention.\n     * @param autoscan false if you want to use configuration instead of convention.\n     * @deprecated you must use automatic discovery\n     */\n    @Deprecated\n    public void setAutoscan(boolean autoscan) {\n        this.autoscan = autoscan;\n    }\n\n    /**\n     * Define the Elasticsearch username. Defaults to \"elastic\".\n     * @param username Elasticsearch username.\n     */\n    public void setUsername(String username) {\n        this.username = username;\n    }\n\n    /**\n     * Define the Elasticsearch password. Must be provided.\n     * @param password Elasticsearch password.\n     */\n    public void setPassword(String password) {\n        this.password = password;\n    }\n\n    /**\n     * Define indices you want to manage with this factory\n     * in case you are not using automatic discovery (see {@link #setAutoscan(boolean)})\n     * @param indices Array of index names\n     * @deprecated you must use automatic discovery (see {@link #setAutoscan(boolean)})\n     */\n    @Deprecated\n    public void setIndices(String[] indices) {\n        this.indices = indices;\n    }\n\n    /**\n     * Define aliases you want to manage with this factory\n     * in case you are not using automatic discovery (see {@link #setAutoscan(boolean)})\n     * @param aliases alias array of aliasname:indexname\n     * @deprecated you must use automatic discovery (see {@link #setAutoscan(boolean)})\n     */\n    @Deprecated\n    public void setAliases(String[] aliases) {\n        this.aliases = aliases;\n    }\n\n    /**\n     * Define the index templates you want to manage with this factory\n     * in case you are not using automatic discovery (see {@link #setAutoscan(boolean)})\n     * @param indexTemplates list of index templates\n     * @deprecated you must use automatic discovery (see {@link #setAutoscan(boolean)})\n     */\n    @Deprecated\n    public void setIndexTemplates(String[] indexTemplates) {\n        this.indexTemplates = indexTemplates;\n    }\n\n    /**\n     * Define component templates you want to manage with this factory\n     * in case you are not using automatic discovery (see {@link #setAutoscan(boolean)})\n     * @param componentTemplates list of component templates\n     * @deprecated you must use automatic discovery (see {@link #setAutoscan(boolean)})\n     */\n    @Deprecated\n    public void setComponentTemplates(String[] componentTemplates) {\n        this.componentTemplates = componentTemplates;\n    }\n\n    /**\n     * Define the pipelines you want to manage with this factory\n     * in case you are not using automatic discovery (see {@link #setAutoscan(boolean)})\n     * @param pipelines list of pipelines\n     * @deprecated you must use automatic discovery (see {@link #setAutoscan(boolean)})\n     */\n    @Deprecated\n    public void setPipelines(String[] pipelines) {\n        this.pipelines = pipelines;\n    }\n\n    /**\n     * Classpath root for index and mapping files (default : /es)\n     * <p>Example :</p>\n     * <pre>\n     * {@code\n     * factory.setClasspathRoot(\"/es\");\n     * }\n     * </pre>\n     * That means that the factory will look in es folder to find index settings.\n     * <br>So if you want to define settings or mappings for the twitter index, you\n     * should put a _settings.json file under /es/twitter/ folder.\n     * @param classpathRoot Classpath root for index and mapping files\n     */\n    public void setClasspathRoot(String classpathRoot) {\n        // For compatibility reasons, we need to convert \"/classpathroot\" to \"classpathroot\"\n        if (classpathRoot.startsWith(\"/\")) {\n            this.classpathRoot = classpathRoot.substring(1);\n        } else {\n\n            this.classpathRoot = classpathRoot;\n        }\n    }\n\n    /**\n     * Define ES nodes to communicate with.\n     * Defaults to [ \"https://localhost:9200\" ].\n     * @param esNodes A collection of nodes\n     */\n    public void setEsNodes(Collection<HttpHost> esNodes) {\n        this.esNodes = esNodes;\n    }\n\n    /**\n     * Define ES nodes to communicate with.\n     * <br>use : protocol://hostname:port form\n     * @param esNodes An array of nodes hostname:port\n     * @deprecated #setEsNodes(HttpHost[])\n     */\n    @Deprecated\n    public void setEsNodes(String[] esNodes) {\n        Collection<HttpHost> hosts = new ArrayList<>(esNodes.length);\n        for (String esNode : esNodes) {\n            hosts.add(HttpHost.create(esNode));\n        }\n\n        this.esNodes = hosts;\n    }\n\n    /**\n     * Define the SSLContext to use if any\n     * @param sslContext    SSLContext\n     * @see SSLUtils#yesSSLContext() for test purposes\n     * @see SSLUtils#createSslContextFromCa(String) when you want to pass the Elasticsearch self-signed certificate\n     */\n    public void setSslContext(SSLContext sslContext) {\n        this.sslContext = sslContext;\n    }\n\n    @Override\n    public void afterPropertiesSet() throws Exception {\n        logger.info(\"Starting Elasticsearch Low Level client\");\n        lowLevelClient = buildElasticsearchLowLevelClient();\n\n        logger.info(\"Starting Elasticsearch client\");\n        // Create the transport with a Jackson mapper\n        ElasticsearchTransport transport = new RestClientTransport(lowLevelClient, new JacksonJsonpMapper());\n        // And create the API client\n        client = new ElasticsearchClient(transport);\n\n        // Automagically initialize the cluster/indices\n        initLifecycles();\n        initPipelines();\n        initTemplates();\n        initSettings();\n        initAliases();\n    }\n\n    @Override\n    public void destroy() {\n        try {\n            logger.info(\"Closing Elasticsearch Low Level client\");\n            if (lowLevelClient != null) {\n                lowLevelClient.close();\n            }\n        } catch (final Exception e) {\n            logger.error(\"Error closing Elasticsearch Low Level client: \", e);\n        }\n    }\n\n    @Override\n    public ElasticsearchClient getObject() {\n        return client;\n    }\n\n    @Override\n    public Class<ElasticsearchClient> getObjectType() {\n        return ElasticsearchClient.class;\n    }\n\n    @Override\n    public boolean isSingleton() {\n        return true;\n    }\n\n    /**\n     * We use convention over configuration : see <a href=\"https://github.com/dadoonet/spring-elasticsearch/issues/3\">...</a>\n     */\n    static String[] computeIndexNames(boolean autoscan, String[] resources, String classpathRoot) {\n        if (!autoscan) {\n            logger.debug(\"Automatic discovery is disabled. Only static resources are used: {}\", (Object) resources);\n            return resources;\n        }\n        if (resources != null && resources.length > 0) {\n            logger.debug(\"Resources are manually provided so we won't do any automatic discovery.\");\n            return resources;\n        }\n\n        if (logger.isDebugEnabled()) {\n            logger.debug(\"Automatic discovery is activated. Looking for definition files in classpath under [{}].\",\n                    classpathRoot);\n        }\n\n        try {\n            // Let's scan our resources\n            return findIndexNames(classpathRoot).toArray(new String[0]);\n        } catch (IOException |URISyntaxException e) {\n            logger.debug(\"Automatic discovery does not succeed for finding json files in classpath under \" + classpathRoot + \".\");\n            logger.trace(\"\", e);\n            return null;\n        }\n    }\n\n    static String[] discoverFromClasspath(boolean autoscan, String[] resources, String classpathRoot, String subdir) {\n        if (!autoscan) {\n            logger.debug(\"Automatic discovery is disabled. Only static resources are used: {}\", (Object) resources);\n            return resources;\n        }\n        if (resources != null && resources.length > 0) {\n            logger.debug(\"Resources are manually provided so we won't do any automatic discovery.\");\n            return resources;\n        }\n\n        logger.debug(\"Automatic discovery is activated. Looking for resource files in classpath under [{}/{}].\",\n                classpathRoot, subdir);\n        ArrayList<String> autoResources = new ArrayList<>();\n        try {\n            // Let's scan our resources\n            List<String> scannedResources = ResourceList.getResourceNames(classpathRoot, subdir);\n            autoResources.addAll(scannedResources);\n\n            return autoResources.toArray(new String[0]);\n        } catch (IOException|URISyntaxException e) {\n            logger.debug(\"Automatic discovery does not succeed for finding json files in classpath under [{}/{}].\", classpathRoot, subdir);\n            logger.trace(\"\", e);\n            return resources;\n        }\n    }\n\n    /**\n     * Init index settings if needed.\n     * <p>Note that you can force to reinit the index using {@link #setForceIndex(boolean)}\n     */\n    private void initSettings() throws Exception {\n        logger.debug(\"Initializing indices\");\n        String[] indices = computeIndexNames(autoscan, this.indices, classpathRoot);\n        // We extract indexes and mappings to manage from mappings definition\n        if (indices != null) {\n            // Let's initialize indexes and mappings if needed\n            for (String index : indices) {\n                logger.debug(\"Initializing index {}\", index);\n                createIndex(lowLevelClient, classpathRoot, index, forceIndex);\n                if (mergeSettings) {\n                    updateSettings(lowLevelClient, classpathRoot, index);\n                }\n            }\n\n            // Let's wait until the index is properly ready to be used\n            client.cluster().health(hrb -> hrb.index(Arrays.stream(indices).toList()).waitForStatus(HealthStatus.Yellow));\n        }\n    }\n\n    /**\n     * It creates or updates:\n     * <ul>\n     *     <li>component templates</li>\n     *     <li>index templates</li>\n     * </ul>\n     */\n    private void initTemplates() throws Exception {\n        logger.debug(\"Initializing component templates\");\n        String[] componentTemplates = discoverFromClasspath(autoscan, this.componentTemplates, classpathRoot, SettingsFinder.Defaults.ComponentTemplatesDir);\n        if (componentTemplates != null) {\n            for (String componentTemplate : componentTemplates) {\n                logger.debug(\"Initializing component template {}\", componentTemplate);\n                Assert.hasText(componentTemplate, \"Can not read component template in [\"\n                        + componentTemplate\n                        + \"]. Check that component template is not empty.\");\n                createComponentTemplate(lowLevelClient, classpathRoot, componentTemplate);\n            }\n        }\n        logger.debug(\"Initializing index templates\");\n        String[] indexTemplates = discoverFromClasspath(autoscan, this.indexTemplates, classpathRoot, SettingsFinder.Defaults.IndexTemplatesDir);\n        if (indexTemplates != null) {\n            for (String indexTemplate : indexTemplates) {\n                logger.debug(\"Initializing index template {}\", indexTemplate);\n                Assert.hasText(indexTemplate, \"Can not read component template in [\"\n                        + indexTemplate\n                        + \"]. Check that component template is not empty.\");\n                createIndexTemplate(lowLevelClient, classpathRoot, indexTemplate);\n            }\n        }\n    }\n\n    /**\n     * It creates or updates the index pipelines\n     */\n    private void initPipelines() throws Exception {\n        logger.debug(\"Initializing ingest pipelines\");\n        String[] pipelines = discoverFromClasspath(autoscan, this.pipelines, classpathRoot, SettingsFinder.Defaults.PipelinesDir);\n        if (pipelines != null) {\n            for (String pipeline : pipelines) {\n                logger.debug(\"Initializing pipeline {}\", pipeline);\n                Assert.hasText(pipeline, \"Can not read pipeline in [\"\n                        + pipeline\n                        + \"]. Check that pipeline is not empty.\");\n                createPipeline(lowLevelClient, classpathRoot, pipeline);\n            }\n        }\n    }\n\n    /**\n     * It creates or updates the index lifecycles\n     */\n    private void initLifecycles() throws Exception {\n        logger.debug(\"Initializing lifecycle policies\");\n        String [] lifecycles = discoverFromClasspath(autoscan, this.lifecycles, classpathRoot, SettingsFinder.Defaults.IndexLifecyclesDir);\n        if (lifecycles != null) {\n            for (String lifecycle : lifecycles) {\n                logger.debug(\"Initializing lifecycle {}\", lifecycle);\n                Assert.hasText(lifecycle, \"Can not read lifecycle in [\"\n                        + lifecycle\n                        + \"]. Check that lifecycle is not empty.\");\n                createIndexLifecycle(lowLevelClient, classpathRoot, lifecycle);\n            }\n        }\n    }\n\n    /**\n     * Init aliases if needed.\n     */\n    private void initAliases() throws Exception {\n        logger.debug(\"Initializing aliases\");\n\n        if (!autoscan) {\n            logger.debug(\"Automatic discovery is disabled. Only static resources are used: {}\", (Object) aliases);\n        } else {\n            logger.debug(\"Automatic discovery is activated. Looking for aliases in classpath under [{}/{}{}].\",\n                    classpathRoot, SettingsFinder.Defaults.AliasesFile, SettingsFinder.Defaults.JsonFileExtension);\n        }\n\n        if (aliases != null && aliases.length > 0) {\n            logger.debug(\"Resources are manually provided so we won't do any automatic discovery.\");\n            String request = \"{\\\"actions\\\":[\";\n            boolean first = true;\n\t\t\tfor (String aliasIndex : aliases) {\n\t\t\t    if (!first) {\n                    request += \",\";\n                }\n\t\t\t    first = false;\n                Tuple<String, String> aliasIndexSplitted = computeAlias(aliasIndex);\n                logger.debug(\"add alias {} on index {}\", aliasIndexSplitted.v2(), aliasIndexSplitted.v1());\n                request += \"{\\\"add\\\":{\\\"index\\\":\\\"\" + aliasIndexSplitted.v1() +\"\\\",\\\"alias\\\":\\\"\" + aliasIndexSplitted.v2() +\"\\\"}}\";\n\t\t\t}\n            request += \"]}\";\n            manageAliasesWithJsonInElasticsearch(lowLevelClient, request);\n        } else {\n\t\t    manageAliases(lowLevelClient, classpathRoot);\n        }\n    }\n\n    static Tuple<String, String> computeAlias(String aliasIndex) {\n        String[] aliasIndexSplitted = aliasIndex.split(\":\");\n        String alias = aliasIndexSplitted[0];\n        String index = aliasIndexSplitted[1];\n\n        if (index == null) throw new IllegalArgumentException(\"Can not read index in [\" + aliasIndex +\n                \"]. Check that aliases contains only aliasname:indexname elements.\");\n        if (alias == null) throw new IllegalArgumentException(\"Can not read mapping in [\" + aliasIndex +\n                \"]. Check that aliases contains only aliasname:indexname elements.\");\n\n        return new Tuple<>(index, alias);\n    }\n\n\tprivate RestClient buildElasticsearchLowLevelClient() {\n        RestClientBuilder rcb = RestClient.builder(esNodes.toArray(new HttpHost[]{}));\n\n        // We need to check if we have a user security property\n        if (username == null || password == null) {\n            throw new IllegalArgumentException(\"From version 8, you MUST define a user and a password to access Elasticsearch.\");\n        }\n\n        final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();\n        credentialsProvider.setCredentials(AuthScope.ANY,\n                new UsernamePasswordCredentials(username, password));\n\n        rcb.setHttpClientConfigCallback(hcb -> {\n            hcb.setDefaultCredentialsProvider(credentialsProvider);\n            if (sslContext != null) {\n                hcb.setSSLContext(sslContext);\n            }\n            return hcb;\n        });\n\n        return rcb.build();\n\t}\n}\n"
  },
  {
    "path": "src/main/java/fr/pilato/spring/elasticsearch/SSLUtils.java",
    "content": "/*\n * Licensed to Elasticsearch under one or more contributor\n * license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright\n * ownership. Elasticsearch licenses this file to you under\n * the Apache License, Version 2.0 (the \"License\"); you may\n * not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch;\n\nimport org.apache.commons.io.IOUtils;\nimport org.apache.http.ssl.SSLContextBuilder;\nimport org.apache.http.ssl.SSLContexts;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport javax.net.ssl.SSLContext;\nimport javax.net.ssl.TrustManagerFactory;\nimport javax.net.ssl.X509TrustManager;\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.security.KeyManagementException;\nimport java.security.KeyStore;\nimport java.security.KeyStoreException;\nimport java.security.NoSuchAlgorithmException;\nimport java.security.cert.Certificate;\nimport java.security.cert.CertificateException;\nimport java.security.cert.CertificateFactory;\nimport java.security.cert.X509Certificate;\n\npublic class SSLUtils {\n    private static final Logger logger = LoggerFactory.getLogger(SSLUtils.class);\n    private static SSLContext yesCtx = null;\n    private static SSLContext checkCertificatesSSLContext = null;\n\n    /**\n     * Returns an SSLContext that will accept any server certificate.\n     * Use with great care and in limited situations, as it allows MITM attacks.\n     */\n    public static SSLContext yesSSLContext() {\n        logger.warn(\"You disabled checking the https certificate. This could lead to \" +\n                \"'Man in the middle' attacks. This setting is only intended for tests.\");\n\n        if (yesCtx == null) {\n            X509TrustManager yesTm = new X509TrustManager() {\n                @Override\n                public void checkClientTrusted(X509Certificate[] certs, String authType) {\n                    // Accept anything\n                }\n\n                @Override\n                public void  checkServerTrusted(X509Certificate[] certs, String authType) {\n                    // Accept anything\n                }\n\n                @Override\n                public X509Certificate[] getAcceptedIssuers() {\n                    return new X509Certificate[0];\n                }\n            };\n\n            try {\n                SSLContext ctx = SSLContext.getInstance(\"SSL\");\n                ctx.init(null, new X509TrustManager[] { yesTm }, null);\n                yesCtx = ctx;\n            } catch (Exception e) {\n                // An exception here means SSL is not supported, which is unlikely\n                throw new RuntimeException(e);\n            }\n        }\n\n        return yesCtx;\n    }\n\n    /**\n     *\n     * @param trustStore\n     * @param keyStoreType  pkcs12\n     * @return\n     */\n    public static SSLContext checkCertificatesSSLContext(String trustStore, String keyStoreType, String keyStorePass) {\n        if (checkCertificatesSSLContext == null) {\n            try {\n                Path trustStorePath = Paths.get(trustStore);\n                KeyStore truststore = KeyStore.getInstance(keyStoreType);\n                try (InputStream is = Files.newInputStream(trustStorePath)) {\n                    truststore.load(is, keyStorePass.toCharArray());\n                }\n                SSLContextBuilder sslBuilder = SSLContexts.custom().loadTrustMaterial(truststore, null);\n                checkCertificatesSSLContext = sslBuilder.build();\n            } catch (IOException | CertificateException | NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) {\n                logger.error(\"Can not load the SSLContext for {}, {}\", trustStore, keyStoreType);\n            }\n        }\n        return checkCertificatesSSLContext;\n    }\n\n    /**\n     * A SSL context based on the self signed CA, so that using this SSL Context allows to connect to the Elasticsearch service\n     * @return a customized SSL Context\n     */\n    public SSLContext createSslContextFromCa(String certPath) {\n        try {\n            byte[] bytes = IOUtils.resourceToByteArray(certPath);\n            CertificateFactory factory = CertificateFactory.getInstance(\"X.509\");\n            Certificate trustedCa = factory.generateCertificate(new ByteArrayInputStream(bytes));\n            KeyStore trustStore = KeyStore.getInstance(\"pkcs12\");\n            trustStore.load(null, null);\n            trustStore.setCertificateEntry(\"ca\", trustedCa);\n\n            final SSLContext sslContext = SSLContext.getInstance(\"TLSv1.3\");\n            TrustManagerFactory tmfactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());\n            tmfactory.init(trustStore);\n            sslContext.init(null, tmfactory.getTrustManagers(), null);\n            return sslContext;\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/java/fr/pilato/spring/elasticsearch/Tuple.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch;\n\npublic class Tuple<V1, V2> {\n\n    public static <V1, V2> Tuple<V1, V2> tuple(V1 v1, V2 v2) {\n        return new Tuple<>(v1, v2);\n    }\n\n    private final V1 v1;\n    private final V2 v2;\n\n    public Tuple(V1 v1, V2 v2) {\n        this.v1 = v1;\n        this.v2 = v2;\n    }\n\n    public V1 v1() {\n        return v1;\n    }\n\n    public V2 v2() {\n        return v2;\n    }\n\n    @Override\n    public String toString() {\n        return \"Tuple [v1=\" + v1 + \", v2=\" + v2 + \"]\";\n    }\n}\n"
  },
  {
    "path": "src/main/resources/org/apache/maven/plugin/announcement/announcement.vm",
    "content": "## Licensed to the Apache Software Foundation (ASF) under one\n## or more contributor license agreements.  See the NOTICE file\n## distributed with this work for additional information\n## regarding copyright ownership.  The ASF licenses this file\n## to you under the Apache License, Version 2.0 (the\n## \"License\"); you may not use this file except in compliance\n## with the License.  You may obtain a copy of the License at\n##\n##  http://www.apache.org/licenses/LICENSE-2.0\n##\n## Unless required by applicable law or agreed to in writing,\n## software distributed under the License is distributed on an\n## \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n## KIND, either express or implied.  See the License for the\n## specific language governing permissions and limitations\n## under the License.\nThe ${developmentTeam} is pleased to announce the **${finalName}** release!\n\n# ${introduction}\n\n<h2>Usage</h2>\n\nAdd this library to you project:\n\n```\n<dependency>\n    <groupId>${project.groupId}</groupId>\n    <artifactId>${project.artifactId}</artifactId>\n    <version>${project.version}</version>\n</dependency>\n```\n\n#if ($release.getActions().size() == 0)\nNo changes defined in this version.\n#else\n\n#if ($release.getActions('add').size() !=0)\n<h2>New features</h2>\n\n#foreach($actionItem in $release.getActions('add'))\n#set($action=$actionItem.getAction())\n#if ($actionItem.getIssue())\n#set($issue=$actionItem.getIssue())\n#else\n#set($issue=\"\")\n#end\n#if ($actionItem.getDueTo())\n#set($dueto=$actionItem.getDueTo())\n#else\n#set($dueto=\"\")\n#end\n* [#$issue](https://github.com/dadoonet/spring-elasticsearch/issues/$issue): ${action} #if($!issue != \"\"). #end#if($!dueto != \"\")Thanks to $dueto. #end\n\n#set($issue=\"\")\n#set($dueto=\"\")\n#end\n#end\n\n#if ($release.getActions('fix').size() !=0)\n<h2>Fixed Bugs</h2>\n\n#foreach($actionItem in $release.getActions('fix'))\n#set($action=$actionItem.getAction())\n#if ($actionItem.getIssue())\n#set($issue=$actionItem.getIssue())\n#else\n#set($issue=\"\")\n#end\n#if ($actionItem.getDueTo())\n#set($dueto=$actionItem.getDueTo())\n#else\n#set($dueto=\"\")\n#end\n* [#$issue](https://github.com/dadoonet/spring-elasticsearch/issues/$issue): ${action} #if($!issue != \"\"). #end#if($!dueto != \"\")Thanks to $dueto. #end\n\n#set($issue=\"\")\n#set($dueto=\"\")\n#end\n#end\n\n#if ($release.getActions('update').size() !=0)\n<h2>Changes</h2>\n\n#foreach($actionItem in $release.getActions('update'))\n#set($action=$actionItem.getAction())\n#if ($actionItem.getIssue())\n#set($issue=$actionItem.getIssue())\n#else\n#set($issue=\"\")\n#end\n#if ($actionItem.getDueTo())\n#set($dueto=$actionItem.getDueTo())\n#else\n#set($dueto=\"\")\n#end\n* [#$issue](https://github.com/dadoonet/spring-elasticsearch/issues/$issue): ${action} #if($!issue != \"\"). #end#if($!dueto != \"\")Thanks to $dueto. #end\n\n#set($issue=\"\")\n#set($dueto=\"\")\n#end\n#end\n\n#if ($release.getActions('remove').size() !=0)\n<h2>Removed</h2>\n\n#foreach($actionItem in $release.getActions('remove'))\n#set($action=$actionItem.getAction())\n#if ($actionItem.getIssue())\n#set($issue=$actionItem.getIssue())\n#else\n#set($issue=\"\")\n#end\n#if ($actionItem.getDueTo())\n#set($dueto=$actionItem.getDueTo())\n#else\n#set($dueto=\"\")\n#end\n* [#$issue](https://github.com/dadoonet/spring-elasticsearch/issues/$issue): ${action} #if($!issue != \"\"). #end#if($!dueto != \"\")Thanks to $dueto. #end\n\n#set($issue=\"\")\n#set($dueto=\"\")\n#end\n#end\n## End of main loop\n#end\n#if ($urlDownload)\n\nFor a manual installation, you can download the ${finalName} here:\n${urlDownload}\n#end\n\nHave fun!\n-${developmentTeam}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/BaseTest.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it;\n\nimport com.fasterxml.jackson.core.type.TypeReference;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport fr.pilato.spring.elasticsearch.SSLUtils;\nimport org.apache.http.HttpHost;\nimport org.apache.http.auth.AuthScope;\nimport org.apache.http.auth.UsernamePasswordCredentials;\nimport org.apache.http.client.CredentialsProvider;\nimport org.apache.http.impl.client.BasicCredentialsProvider;\nimport org.elasticsearch.client.Request;\nimport org.elasticsearch.client.Response;\nimport org.elasticsearch.client.ResponseException;\nimport org.elasticsearch.client.RestClient;\nimport org.elasticsearch.client.RestClientBuilder;\nimport org.junit.jupiter.api.AfterAll;\nimport org.junit.jupiter.api.AfterEach;\nimport org.junit.jupiter.api.BeforeAll;\nimport org.junit.jupiter.api.BeforeEach;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport java.io.IOException;\nimport java.net.ConnectException;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\n\nimport static org.junit.jupiter.api.Assumptions.assumeFalse;\n\npublic abstract class BaseTest {\n    private final static Logger staticLogger = LoggerFactory.getLogger(BaseTest.class);\n    protected final Logger logger = LoggerFactory.getLogger(this.getClass().getName());\n\n    private static RestClient client;\n\n    public final static String DEFAULT_TEST_CLUSTER = \"https://127.0.0.1:9200\";\n    private final static String DEFAULT_TEST_USER = \"elastic\";\n    private final static String DEFAULT_TEST_PASSWORD = \"changeme\";\n\n    public final static String testCluster = System.getProperty(\"tests.cluster\", DEFAULT_TEST_CLUSTER);\n    public final static String testClusterUser = System.getProperty(\"tests.cluster.user\", DEFAULT_TEST_USER);\n    public final static String testClusterPass = System.getProperty(\"tests.cluster.pass\", DEFAULT_TEST_PASSWORD);\n\n    private static void testClusterRunning() throws IOException {\n        try {\n            Response response = client.performRequest(new Request(\"GET\", \"/\"));\n            Map<String, Object> result = new ObjectMapper().readValue(response.getEntity().getContent(), new TypeReference<>() {\n            });\n\n            Map<String, Object> asMap = (Map<String, Object>) result.get(\"version\");\n\n            staticLogger.info(\"Starting integration tests against an external cluster running elasticsearch [{}]\",\n                    asMap.get(\"number\"));\n        } catch (ConnectException e) {\n            // If we have an exception here, let's ignore the test\n            staticLogger.warn(\"Integration tests are skipped: [{}]\", e.getMessage());\n            assumeFalse(e.getMessage().contains(\"Connection refused\"), \"Integration tests are skipped\");\n        } catch (IOException e) {\n            staticLogger.error(\"Full error is\", e);\n            throw e;\n        }\n    }\n\n\n    @BeforeAll\n    public static void startElasticsearchClient() {\n        try {\n            if (client == null) {\n                staticLogger.info(\"Starting tests against {}\", testCluster);\n                RestClientBuilder builder = RestClient.builder(HttpHost.create(testCluster));\n                final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();\n                credentialsProvider.setCredentials(AuthScope.ANY,\n                        new UsernamePasswordCredentials(testClusterUser, testClusterPass));\n\n                builder.setHttpClientConfigCallback(hcb -> {\n                    hcb.setDefaultCredentialsProvider(credentialsProvider);\n                    if (testCluster.equals(DEFAULT_TEST_CLUSTER)) {\n                        hcb.setSSLContext(SSLUtils.yesSSLContext());\n                    }\n                    return hcb;\n                });\n\n                client = builder.build();\n                testClusterRunning();\n            }\n        } catch (Exception e) {\n            staticLogger.error(\"Error\", e);\n            assumeFalse(true, \"Elasticsearch does not seem to run.\");\n        }\n    }\n\n    @AfterAll\n    public static void stopClient() throws IOException {\n        if (client != null) {\n            client.close();\n            client = null;\n        }\n    }\n\n    protected void executeBefore(RestClient client) throws IOException {\n        // Do nothing\n    }\n\n    @BeforeEach @AfterEach\n    public void cleanIndex() throws IOException {\n        if (indexName() != null) {\n            deleteIndex(indexName());\n        }\n        for (String otherTestIndex : otherTestIndices()) {\n            deleteIndex(otherTestIndex);\n        }\n        deleteIndex(\"twitter\");\n        executeBefore(client);\n    }\n\n    private void deleteIndex(String indexName) throws IOException {\n        try {\n            logger.debug(\"Removing index {}\", indexName);\n            client.performRequest(new Request(\"DELETE\", \"/\" + indexName));\n            logger.debug(\"Removing index {} - ok\", indexName);\n        } catch (ResponseException e) {\n            if (e.getResponse().getStatusLine().getStatusCode() != 404) {\n                throw e;\n            }\n            logger.debug(\"Removing index {} - not found\", indexName);\n        }\n    }\n\n    /**\n     * Overwrite if twitter is not the index name. Can be null if no index should be created\n     * @return Index name. Could be null\n     */\n    protected String indexName() {\n        return \"twitter\";\n    }\n\n    /**\n     * Overwrite if the test is using multiple indices. Can be null if no other index should be created\n     * @return Index name. Could be null\n     */\n    protected List<String> otherTestIndices() {\n        return new ArrayList<>();\n    }\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/AbstractAnnotationContextModel.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation;\n\nimport fr.pilato.spring.elasticsearch.it.BaseTest;\nimport org.junit.jupiter.api.AfterEach;\nimport org.junit.jupiter.api.BeforeEach;\nimport org.springframework.context.annotation.AnnotationConfigApplicationContext;\n\npublic abstract class AbstractAnnotationContextModel extends BaseTest {\n    protected AnnotationConfigApplicationContext ctx;\n\n    /**\n     * @return list of specific classpath to load if not the default one\n     */\n    String classpath() {\n        return null;\n    }\n\n    @BeforeEach\n    void startContext() {\n        String classpath = classpath();\n\n        if (classpath == null || classpath.isEmpty()) {\n            // If not set, the test package name is used.\n            classpath = this.getClass().getPackage().getName();\n        }\n\n        logger.info(\"  --> Starting Spring Context on [{}] classpath\", classpath);\n        ctx = new AnnotationConfigApplicationContext();\n        ctx.scan(classpath);\n        ctx.refresh();\n    }\n\n    @AfterEach\n    void stopContext() {\n        if (ctx != null) {\n            logger.info(\"  --> Closing Spring Context\");\n            ctx.close();\n        }\n    }\n\n    /**\n     * Overwrite it if the number of expected shards is not 5\n     * @return Number of expected primaries\n     */\n    protected int expectedShards() {\n        return 1;\n    }\n\n    /**\n     * Overwrite it if the number of expected replicas is not 1\n     * @return Number of expected replicas\n     */\n    protected int expectedReplicas() {\n        return 1;\n    }\n\n    protected String beanName() {\n        return \"esClient\";\n    }\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/AbstractRestAnnotationContextModel.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport co.elastic.clients.elasticsearch.core.GetResponse;\nimport co.elastic.clients.elasticsearch.indices.GetIndicesSettingsResponse;\nimport fr.pilato.spring.elasticsearch.it.annotation.AbstractAnnotationContextModel;\nimport org.junit.jupiter.api.Test;\n\nimport java.io.IOException;\nimport java.io.StringReader;\n\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.Matchers.*;\n\npublic abstract class AbstractRestAnnotationContextModel extends AbstractAnnotationContextModel {\n    protected ElasticsearchClient checkClient(String name) {\n        ElasticsearchClient client;\n\n        if (name != null) {\n            client = ctx.getBean(name, ElasticsearchClient.class);\n        } else {\n            client = ctx.getBean(ElasticsearchClient.class);\n        }\n        assertThat(client, not(nullValue()));\n        return client;\n    }\n\n    @Test\n    public void testFactoriesCreated() throws Exception {\n        ElasticsearchClient client = checkClient(beanName());\n        checkUseCaseSpecific(client);\n\n        // If an index is expected, let's check it actually exists\n        if (indexName() != null) {\n            // We test how many shards and replica we have\n            assertShardsAndReplicas(client, indexName(), expectedShards(), expectedReplicas());\n\n            // #92: search errors with async created Client\n            client.index(ir -> ir.index(\"twitter\").id(\"1\").withJson(new StringReader(\"{\\\"foo\\\":\\\"bar\\\"}\")));\n            GetResponse<Void> response = client.get(gr -> gr.index(\"twitter\").id(\"1\"), Void.class);\n            assertThat(response, notNullValue());\n        }\n    }\n\n    /**\n     * Overwrite it to implement use case specific tests\n     * @param client Client representing bean named esClient\n     */\n    protected void checkUseCaseSpecific(ElasticsearchClient client) throws Exception {\n    }\n\n    protected void assertShardsAndReplicas(ElasticsearchClient client, String indexName, int expectedShards, int expectedReplicas) throws IOException {\n        GetIndicesSettingsResponse settings = client.indices().getSettings(gisr -> gisr.index(indexName));\n        assertThat(Integer.parseInt(settings.get(indexName).settings().index().numberOfShards()), is(expectedShards));\n        assertThat(Integer.parseInt(settings.get(indexName).settings().index().numberOfReplicas()), is(expectedReplicas));\n    }\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/RestAppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport fr.pilato.spring.elasticsearch.SSLUtils;\nimport org.apache.http.HttpHost;\nimport org.springframework.context.annotation.Bean;\n\nimport java.util.List;\n\nimport static fr.pilato.spring.elasticsearch.it.BaseTest.*;\n\npublic abstract class RestAppConfig {\n\n\tabstract protected void enrichFactory(ElasticsearchClientFactoryBean factory);\n\n\t@Bean\n\tpublic ElasticsearchClient esClient() throws Exception {\n\t\tElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\n\t\tenrichFactoryWithNodeSettings(factory);\n\t\tenrichFactory(factory);\n\t\tfactory.afterPropertiesSet();\n\t\treturn factory.getObject();\n\t}\n\n\tpublic static void enrichFactoryWithNodeSettings(ElasticsearchClientFactoryBean factory) {\n\t\tfactory.setEsNodes(List.of(HttpHost.create(testCluster)));\n\t\tfactory.setUsername(testClusterUser);\n\t\tfactory.setPassword(testClusterPass);\n\t\tif (testCluster.equals(DEFAULT_TEST_CLUSTER)) {\n\t\t\tfactory.setSslContext(SSLUtils.yesSSLContext());\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/aliases/AliasesTest.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.aliases;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport co.elastic.clients.elasticsearch.indices.get_alias.IndexAliases;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.AbstractRestAnnotationContextModel;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport static java.util.Arrays.asList;\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.Matchers.hasKey;\nimport static org.hamcrest.Matchers.not;\n\npublic class AliasesTest extends AbstractRestAnnotationContextModel {\n\n    @Override\n    protected List<String> otherTestIndices() {\n        return asList(\"test_1\", \"test_2\");\n    }\n\n    @Override\n    protected void checkUseCaseSpecific(ElasticsearchClient client) throws Exception {\n        Map<String, IndexAliases> response = client.indices().getAlias(gar -> gar.name(\"test\")).result();\n        assertThat(response, not(hasKey(\"test_1\")));\n        assertThat(response, hasKey(\"test_2\"));\n    }\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/aliases/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.aliases;\n\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\npublic class AppConfig extends RestAppConfig {\n\n\t@Override\n\tprotected void enrichFactory(ElasticsearchClientFactoryBean factory) {\n\t\tfactory.setClasspathRoot(\"/models/root/aliases\");\n\t}\n\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/badclasspath/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.badclasspath;\n\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\npublic class AppConfig extends RestAppConfig {\n\n\t@Override\n\tprotected void enrichFactory(ElasticsearchClientFactoryBean factory) {\n\t\tfactory.setClasspathRoot(\"/esdoesnotexist\");\n\t}\n\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/badclasspath/BadClasspath7Test.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.badclasspath;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.AbstractRestAnnotationContextModel;\n\nimport java.io.IOException;\n\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.Matchers.is;\n\n\npublic class BadClasspath7Test extends AbstractRestAnnotationContextModel {\n    @Override\n    public String indexName() {\n        return null;\n    }\n\n    @Override\n    protected void checkUseCaseSpecific(ElasticsearchClient client) throws IOException {\n        assertThat(\"twitter index should not exist\", client.indices().exists(er -> er.index(\"twitter\")).value(), is(false));\n    }\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/configuration/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.configuration;\n\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\npublic class AppConfig extends RestAppConfig {\n\n\t@Override\n\tprotected void enrichFactory(ElasticsearchClientFactoryBean factory) {\n\t}\n\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/configuration/ConfigurationTest.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.configuration;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.AbstractRestAnnotationContextModel;\n\nclass ConfigurationTest extends AbstractRestAnnotationContextModel {\n\n\t@Override\n\tprotected void checkUseCaseSpecific(ElasticsearchClient client) throws Exception {\n\t\t// We call the Rest client to make sure it works properly\n\t\tclient.info();\n\t}\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/customanalyzers/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.customanalyzers;\n\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\npublic class AppConfig extends RestAppConfig {\n\n\t@Override\n\tprotected void enrichFactory(ElasticsearchClientFactoryBean factory) {\n\t\tfactory.setClasspathRoot(\"/models/root/custom-analyzers-12/client\");\n\t}\n\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/customanalyzers/CustomAnalyzers12Test.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.customanalyzers;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.AbstractRestAnnotationContextModel;\n\nimport java.io.IOException;\n\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.Matchers.is;\n\n\npublic class CustomAnalyzers12Test extends AbstractRestAnnotationContextModel {\n\n    @Override\n    protected void checkUseCaseSpecific(ElasticsearchClient client) throws IOException {\n        assertThat(client.indices().getSettings(gisr -> gisr.index(\"twitter\"))\n                .get(\"twitter\").settings().index().analysis().analyzer().get(\"francais\").isCustom(),\n                is(true));\n    }\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/indextemplates/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.indextemplates;\n\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\npublic class AppConfig extends RestAppConfig {\n\n\t@Override\n\tprotected void enrichFactory(ElasticsearchClientFactoryBean factory) {\n\t\tfactory.setClasspathRoot(\"/models/root/index-templates/client\");\n\t}\n\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/indextemplates/IndexTemplatesTest.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.indextemplates;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.AbstractRestAnnotationContextModel;\nimport org.elasticsearch.client.Request;\nimport org.elasticsearch.client.ResponseException;\nimport org.elasticsearch.client.RestClient;\n\nimport java.io.IOException;\n\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.Matchers.is;\n\n\npublic class IndexTemplatesTest extends AbstractRestAnnotationContextModel {\n\n    @Override\n    protected void executeBefore(RestClient client) throws IOException {\n        try {\n            client.performRequest(new Request(\"DELETE\", \"/_index_template/template_1\"));\n        } catch (ResponseException ignored) { }\n        try {\n            client.performRequest(new Request(\"DELETE\", \"/_component_template/component1\"));\n        } catch (ResponseException ignored) { }\n        try {\n            client.performRequest(new Request(\"DELETE\", \"/_component_template/component2\"));\n        } catch (ResponseException ignored) { }\n    }\n\n    @Override\n    protected String indexName() {\n        return null;\n    }\n\n    protected void checkUseCaseSpecific(ElasticsearchClient client) throws IOException {\n        boolean existsTemplate = client.indices().existsIndexTemplate(eit -> eit.name(\"template_1\")).value();\n        assertThat(existsTemplate, is(true));\n    }\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/indicesalreadyexist/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.indicesalreadyexist;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\npublic class AppConfig extends RestAppConfig {\n\n\t@Override\n\tprotected void enrichFactory(ElasticsearchClientFactoryBean factory) {\n\t\tfactory.setClasspathRoot(\"/models/root/indices-already-exist-86/client\");\n\t}\n\n\t@Bean\n\tpublic ElasticsearchClient esClient2() throws Exception {\n\t\tElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\n\t\tenrichFactoryWithNodeSettings(factory);\n\t\tfactory.setClasspathRoot(\"/models/root/indices-already-exist-86/client\");\n\t\tfactory.afterPropertiesSet();\n\t\treturn factory.getObject();\n\t}\n\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/indicesalreadyexist/IndicesAlreadyExistTest.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.indicesalreadyexist;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.AbstractRestAnnotationContextModel;\nimport org.junit.jupiter.api.Test;\n\nimport java.util.Collections;\nimport java.util.List;\n\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.Matchers.notNullValue;\n\npublic class IndicesAlreadyExistTest extends AbstractRestAnnotationContextModel {\n\n    @Override\n    protected List<String> otherTestIndices() {\n        return Collections.singletonList(\"badindex\");\n    }\n\n    @Test\n    void testTwoClients() {\n        ElasticsearchClient esClient = checkClient(\"esClient\");\n        assertThat(esClient, notNullValue());\n        ElasticsearchClient esClient2 = checkClient(\"esClient2\");\n        assertThat(esClient2, notNullValue());\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/lifecycles/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.lifecycles;\n\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\npublic class AppConfig extends RestAppConfig {\n\n\t@Override\n\tprotected void enrichFactory(ElasticsearchClientFactoryBean factory) {\n\t\tfactory.setClasspathRoot(\"/models/root/lifecycles\");\n\t}\n\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/lifecycles/LifecyclesTest.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.lifecycles;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.AbstractRestAnnotationContextModel;\nimport org.elasticsearch.client.Request;\nimport org.elasticsearch.client.ResponseException;\nimport org.elasticsearch.client.RestClient;\n\nimport java.io.IOException;\n\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.Matchers.notNullValue;\n\n\npublic class LifecyclesTest extends AbstractRestAnnotationContextModel {\n\n    @Override\n    protected void executeBefore(RestClient client) throws IOException {\n        try {\n            client.performRequest(new Request(\"DELETE\", \"/_ilm/policy/policy1\"));\n        } catch (ResponseException ignored) { }\n    }\n\n    protected void checkUseCaseSpecific(ElasticsearchClient client) throws IOException {\n        assertThat(client.ilm().getLifecycle(glr -> glr.name(\"policy1\")), notNullValue());\n    }\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/manualsettings/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.manualsettings;\n\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\npublic class AppConfig extends RestAppConfig {\n\n\t@Override\n\tprotected void enrichFactory(ElasticsearchClientFactoryBean factory) {\n\t\tfactory.setClasspathRoot(\"/models/root/manual-settings\");\n\t\tfactory.setIndices(new String[]{\"twitter\"});\n\t\tfactory.setAliases(new String[]{\"alltheworld:twitter\"});\n\t\tfactory.setPipelines(new String[]{\"pipeline1\"});\n\t\tfactory.setComponentTemplates(new String[]{\"component1\"});\n\t\tfactory.setIndexTemplates(new String[]{\"template_1\"});\n\t}\n\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/manualsettings/ManualSettingsTest.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.manualsettings;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport co.elastic.clients.elasticsearch._types.ElasticsearchException;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.AbstractRestAnnotationContextModel;\nimport org.elasticsearch.client.Request;\nimport org.elasticsearch.client.ResponseException;\nimport org.elasticsearch.client.RestClient;\n\nimport java.io.IOException;\n\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.Matchers.*;\nimport static org.junit.jupiter.api.Assertions.assertThrows;\n\npublic class ManualSettingsTest extends AbstractRestAnnotationContextModel {\n    @Override\n    protected void executeBefore(RestClient client) throws IOException {\n        try {\n            client.performRequest(new Request(\"DELETE\", \"/_index_template/template_1\"));\n        } catch (ResponseException ignored) { }\n        try {\n            client.performRequest(new Request(\"DELETE\", \"/_component_template/component1\"));\n        } catch (ResponseException ignored) { }\n        try {\n            client.performRequest(new Request(\"DELETE\", \"/_pipeline/pipeline1\"));\n        } catch (ResponseException ignored) { }\n    }\n\n    @Override\n    protected void checkUseCaseSpecific(ElasticsearchClient client) throws Exception {\n        // Test manual creation of one index even though we have multiple ones in the classpath\n        assertThat(client.indices().get(gir -> gir.index(\"twitter\")).result(), hasKey(\"twitter\"));\n        assertThat(client.indices().get(gir -> gir.index(\"foobar\").ignoreUnavailable(true)).result(), not(hasKey(\"twitter\")));\n\n        // Test manual creation of one alias even though we have multiple ones in the classpath\n        assertThat(client.indices().getAlias(gar -> gar.index(\"twitter\")).result().get(\"twitter\").aliases(), hasKey(\"alltheworld\"));\n        assertThat(client.indices().getAlias(gar -> gar.index(\"twitter\")).result().get(\"twitter\").aliases(), not(hasKey(\"alias\")));\n\n        // Test manual creation of one pipeline even though we have multiple ones in the classpath\n        assertThat(client.ingest().getPipeline(gpr -> gpr.id(\"pipeline1\")).get(\"pipeline1\"), notNullValue());\n        assertThat(client.ingest().getPipeline(gpr -> gpr.id(\"pipeline2\")).get(\"pipeline2\"), nullValue());\n\n        // Test manual creation of one component template even though we have multiple ones in the classpath\n        assertThat(client.cluster().getComponentTemplate(gctr -> gctr.name(\"component1\")).componentTemplates(), hasSize(1));\n        assertThrows(ElasticsearchException.class, () -> {\n            try {\n                client.cluster().getComponentTemplate(gctr -> gctr.name(\"component2\"));\n            } catch (ElasticsearchException e) {\n                assertThat(e.status(), is(404));\n                throw e;\n            }\n        });\n\n        // Test manual creation of one index template even though we have multiple ones in the classpath\n        assertThat(client.indices().existsIndexTemplate(eit -> eit.name(\"template_1\")).value(), is(true));\n        assertThat(client.indices().existsIndexTemplate(eit -> eit.name(\"template_2\")).value(), is(false));\n    }\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/mapping/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.mapping;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\npublic class AppConfig extends RestAppConfig {\n\n\t@Override\n\tprotected void enrichFactory(ElasticsearchClientFactoryBean factory) {\n\t\tfactory.setClasspathRoot(\"/models/root/mapping/client1\");\n\t\tfactory.setForceIndex(false);\n\t}\n\n\t@Bean\n\tpublic ElasticsearchClient esClient2() throws Exception {\n\t\tElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\n\t\tenrichFactoryWithNodeSettings(factory);\n\t\tfactory.setClasspathRoot(\"/models/root/mapping/client2\");\n\t\tfactory.setMergeSettings(true);\n\t\tfactory.afterPropertiesSet();\n\t\treturn factory.getObject();\n\t}\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/mapping/MappingTest.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.mapping;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport co.elastic.clients.elasticsearch._types.mapping.Property;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.AbstractRestAnnotationContextModel;\n\nimport java.io.IOException;\nimport java.util.Map;\n\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.Matchers.hasKey;\n\n\npublic class MappingTest extends AbstractRestAnnotationContextModel {\n\n    protected void checkUseCaseSpecific(ElasticsearchClient client) throws IOException {\n        ElasticsearchClient client2 = checkClient(\"esClient2\");\n\n        Map<String, Property> response = client2.indices()\n                .getMapping(gmr -> gmr.index(\"twitter\")).get(\"twitter\").mappings().properties();\n        // This one comes from the first mapping\n        assertThat(response, hasKey(\"message\"));\n        // This one comes from the second mapping\n        assertThat(response, hasKey(\"author\"));\n    }\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/mappingconvention/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.mappingconvention;\n\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\npublic class AppConfig extends RestAppConfig {\n\n\t@Override\n\tprotected void enrichFactory(ElasticsearchClientFactoryBean factory) {\n\n\t}\n\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/mappingconvention/MappingConventionTest.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.mappingconvention;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport co.elastic.clients.elasticsearch._types.mapping.Property;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.AbstractRestAnnotationContextModel;\n\nimport java.io.IOException;\n\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.Matchers.is;\nimport static org.hamcrest.Matchers.notNullValue;\n\npublic class MappingConventionTest extends AbstractRestAnnotationContextModel {\n\n    @Override\n    protected void checkUseCaseSpecific(ElasticsearchClient client) throws IOException {\n        Property property = client.indices().getMapping(gmr -> gmr.index(\"twitter\")).get(\"twitter\").mappings().properties().get(\"message\");\n        assertThat(property, notNullValue());\n        assertThat(property.text().store(), is(true));\n    }\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/mappingfailed/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.mappingfailed;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\n\nimport static fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig.enrichFactoryWithNodeSettings;\n\n@Configuration\npublic class AppConfig {\n\n\t@Bean\n\tpublic ElasticsearchClient esClient() throws Exception {\n\t\tElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\n\t\tenrichFactoryWithNodeSettings(factory);\n\t\tfactory.setClasspathRoot(\"/models/root/mapping-failed/client1\");\n\t\tfactory.setForceIndex(false);\n\t\tfactory.afterPropertiesSet();\n\t\treturn factory.getObject();\n\t}\n\n\t@Bean\n\tpublic ElasticsearchClient esClient2() throws Exception {\n\t\tElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\n\t\tenrichFactoryWithNodeSettings(factory);\n\t\tfactory.setClasspathRoot(\"/models/root/mapping-failed/client2\");\n\t\tfactory.setMergeSettings(true);\n\t\tfactory.afterPropertiesSet();\n\t\treturn factory.getObject();\n\t}\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/mappingfailed/MappingFailedTest.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.mappingfailed;\n\nimport fr.pilato.spring.elasticsearch.it.BaseTest;\nimport org.elasticsearch.client.ResponseException;\nimport org.junit.jupiter.api.Test;\nimport org.springframework.beans.factory.BeanCreationException;\nimport org.springframework.context.annotation.AnnotationConfigApplicationContext;\n\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.Matchers.is;\nimport static org.junit.jupiter.api.Assertions.assertEquals;\nimport static org.junit.jupiter.api.Assertions.assertThrows;\n\n/**\n * We try to merge non merging mapping.\n * An exception should be raised.\n * @author David Pilato aka dadoonet\n *\n */\npublic class MappingFailedTest extends BaseTest {\n\n\t@Override\n\tpublic String indexName() {\n\t\treturn null;\n\t}\n\n\t@Test\n\tvoid test_rest_client() {\n\t\tassertThrows(BeanCreationException.class, () -> {\n\t\t\ttry {\n\t\t\t\tlogger.info(\"  --> Starting Spring Context on [{}] classpath\", this.getClass().getPackage().getName());\n\t\t\t\tnew AnnotationConfigApplicationContext(AppConfig.class);\n\t\t\t} catch (BeanCreationException e) {\n\t\t\t\tThrowable cause = e.getCause().getCause();\n\t\t\t\tassertEquals(ResponseException.class, cause.getClass());\n\t\t\t\tResponseException responseException = (ResponseException) cause;\n\t\t\t\tassertThat(responseException.getResponse().getStatusLine().getStatusCode(), is(400));\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t});\n\t}\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/multipleclients/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.multipleclients;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\n\nimport static fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig.enrichFactoryWithNodeSettings;\n\n@Configuration\npublic class AppConfig {\n\n\t@Bean\n\tpublic ElasticsearchClient esClient() throws Exception {\n\t\tElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\n\t\tenrichFactoryWithNodeSettings(factory);\n\t\tfactory.setClasspathRoot(\"/models/root/multiple-clients/client1\");\n\t\tfactory.setForceIndex(false);\n\t\tfactory.afterPropertiesSet();\n\t\treturn factory.getObject();\n\t}\n\n\t@Bean\n\tpublic ElasticsearchClient esClient2() throws Exception {\n\t\tElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\n\t\tenrichFactoryWithNodeSettings(factory);\n\t\tfactory.setClasspathRoot(\"/models/root/multiple-clients/client2\");\n\t\tfactory.setMergeSettings(true);\n\t\tfactory.afterPropertiesSet();\n\t\treturn factory.getObject();\n\t}\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/multipleclients/MultipleClientsTest.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.multipleclients;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.AbstractRestAnnotationContextModel;\n\nimport java.io.IOException;\n\npublic class MultipleClientsTest extends AbstractRestAnnotationContextModel {\n\n\tprotected void checkUseCaseSpecific(ElasticsearchClient client) throws IOException {\n\t\tElasticsearchClient client2 = checkClient(\"esClient2\");\n\t\t// We test how many shards and replica we have\n\t\t// Let's do the same thing with the second client\n\t\t// We test how many shards and replica we have\n\t\t// We don't expect the number of replicas to be 4 as we won't merge _update_settings.json\n\t\t// See #31: https://github.com/dadoonet/spring-elasticsearch/issues/31\n\t\tassertShardsAndReplicas(client2, \"twitter\", 1, 1);\n\t}\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/pipelines/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.pipelines;\n\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\npublic class AppConfig extends RestAppConfig {\n\n\t@Override\n\tprotected void enrichFactory(ElasticsearchClientFactoryBean factory) {\n\t\tfactory.setClasspathRoot(\"/models/root/pipelines\");\n\t}\n\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/pipelines/PipelinesTest.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.pipelines;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.AbstractRestAnnotationContextModel;\nimport org.elasticsearch.client.Request;\nimport org.elasticsearch.client.ResponseException;\nimport org.elasticsearch.client.RestClient;\n\nimport java.io.IOException;\n\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.Matchers.notNullValue;\n\n\npublic class PipelinesTest extends AbstractRestAnnotationContextModel {\n\n    @Override\n    protected void executeBefore(RestClient client) throws IOException {\n        try {\n            client.performRequest(new Request(\"DELETE\", \"/_pipeline/pipeline1\"));\n        } catch (ResponseException ignored) { }\n    }\n\n    @Override\n    protected String indexName() {\n        return null;\n    }\n\n    protected void checkUseCaseSpecific(ElasticsearchClient client) throws IOException {\n        assertThat(client.ingest().getPipeline(gpr -> gpr.id(\"pipeline1\")).get(\"pipeline1\"), notNullValue());\n    }\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/settings13/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.settings13;\n\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\npublic class AppConfig extends RestAppConfig {\n\n\t@Override\n\tprotected void enrichFactory(ElasticsearchClientFactoryBean factory) {\n\t\tfactory.setClasspathRoot(\"/models/root/settings-13/client\");\n\t\tfactory.setForceIndex(true);\n\t}\n\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/settings13/Settings13Test.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.settings13;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.AbstractRestAnnotationContextModel;\n\nimport java.io.IOException;\nimport java.util.Collections;\nimport java.util.List;\n\n\npublic class Settings13Test extends AbstractRestAnnotationContextModel {\n\n    @Override\n    protected List<String> otherTestIndices() {\n        return Collections.singletonList(\"rss\");\n    }\n\n    protected void checkUseCaseSpecific(ElasticsearchClient client) throws IOException {\n        assertShardsAndReplicas(client, \"rss\", 1, 1);\n    }\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/settingsfailed/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.settingsfailed;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\n\nimport static fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig.enrichFactoryWithNodeSettings;\n\n@Configuration\npublic class AppConfig {\n\n\t@Bean\n\tpublic ElasticsearchClient esClient() throws Exception {\n\t\tElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\n\t\tenrichFactoryWithNodeSettings(factory);\n\t\tfactory.setClasspathRoot(\"/models/root/settings-failed/client1\");\n\t\tfactory.setForceIndex(false);\n\t\tfactory.afterPropertiesSet();\n\t\treturn factory.getObject();\n\t}\n\n\t@Bean\n\tpublic ElasticsearchClient esClient2() throws Exception {\n\t\tElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\n\t\tenrichFactoryWithNodeSettings(factory);\n\t\tfactory.setClasspathRoot(\"/models/root/settings-failed/client2\");\n\t\tfactory.setMergeSettings(true);\n\t\tfactory.afterPropertiesSet();\n\t\treturn factory.getObject();\n\t}\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/settingsfailed/SettingsFailedTest.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.settingsfailed;\n\nimport fr.pilato.spring.elasticsearch.it.BaseTest;\nimport org.elasticsearch.client.ResponseException;\nimport org.junit.jupiter.api.Test;\nimport org.springframework.beans.factory.BeanCreationException;\nimport org.springframework.context.annotation.AnnotationConfigApplicationContext;\n\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.Matchers.containsString;\nimport static org.hamcrest.Matchers.is;\nimport static org.junit.jupiter.api.Assertions.assertEquals;\nimport static org.junit.jupiter.api.Assertions.assertThrows;\n\n/**\n * We try to merge non merging mapping.\n * An exception should be raised.\n * @author David Pilato aka dadoonet\n *\n */\npublic class SettingsFailedTest extends BaseTest {\n\n\t@Override\n\tpublic String indexName() {\n\t\treturn null;\n\t}\n\n\t@Test\n\tvoid test_rest_client() {\n\t\tassertThrows(BeanCreationException.class, () -> {\n\t\t\ttry {\n\t\t\t\tlogger.info(\"  --> Starting Spring Context on [{}] classpath\", this.getClass().getPackage().getName());\n\t\t\t\tnew AnnotationConfigApplicationContext(AppConfig.class);\n\t\t\t} catch (BeanCreationException e) {\n\t\t\t\tThrowable cause = e.getCause().getCause();\n\t\t\t\tassertEquals(ResponseException.class, cause.getClass());\n\t\t\t\tResponseException responseException = (ResponseException) cause;\n\t\t\t\tassertThat(responseException.getResponse().getStatusLine().getStatusCode(), is(400));\n\t\t\t\tassertThat(responseException.getMessage(), containsString(\"Can't update non dynamic settings\"));\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t});\n\t}\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/settingsnomapping21/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.settingsnomapping21;\n\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\npublic class AppConfig extends RestAppConfig {\n\n\t@Override\n\tprotected void enrichFactory(ElasticsearchClientFactoryBean factory) {\n\t\tfactory.setClasspathRoot(\"/models/root/settings-no-mapping-21/client\");\n\t}\n\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/settingsnomapping21/SettingsNoMapping21Test.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.settingsnomapping21;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.AbstractRestAnnotationContextModel;\n\nimport java.io.IOException;\n\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.Matchers.hasKey;\n\n\npublic class SettingsNoMapping21Test extends AbstractRestAnnotationContextModel {\n\n    protected void checkUseCaseSpecific(ElasticsearchClient client) throws IOException {\n        // We should have an existing index here\n        assertThat(client.indices().get(gir -> gir.index(\"twitter\")).result(), hasKey(\"twitter\"));\n    }\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/shards/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.shards;\n\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\npublic class AppConfig extends RestAppConfig {\n\n\t@Override\n\tprotected void enrichFactory(ElasticsearchClientFactoryBean factory) {\n\t\tfactory.setClasspathRoot(\"/models/root/shards/client\");\n\t\tfactory.setForceIndex(true);\n\t}\n\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/updatesettingsdisabled31/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.updatesettingsdisabled31;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\n\nimport static fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig.enrichFactoryWithNodeSettings;\n\n@Configuration\npublic class AppConfig {\n\n\t@Bean\n\tpublic ElasticsearchClient esClient() throws Exception {\n\t\tElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\n\t\tenrichFactoryWithNodeSettings(factory);\n\t\tfactory.setClasspathRoot(\"/models/root/update-settings-31/client1\");\n\t\tfactory.afterPropertiesSet();\n\t\treturn factory.getObject();\n\t}\n\n\t@Bean\n\tpublic ElasticsearchClient esClient2() throws Exception {\n\t\tElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\n\t\tenrichFactoryWithNodeSettings(factory);\n\t\tfactory.setClasspathRoot(\"/models/root/update-settings-31/client2\");\n\t\tfactory.setMergeSettings(false);\n\t\tfactory.afterPropertiesSet();\n\t\treturn factory.getObject();\n\t}\n\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/updatesettingsdisabled31/UpdateSettingsDisabled31Test.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.updatesettingsdisabled31;\n\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.AbstractRestAnnotationContextModel;\n\npublic class UpdateSettingsDisabled31Test extends AbstractRestAnnotationContextModel {\n\n    @Override\n    protected int expectedShards() {\n        return 2;\n    }\n\n    @Override\n    protected int expectedReplicas() {\n        return 0;\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/updatesettingsenabled31/AppConfig.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.updatesettingsenabled31;\n\nimport co.elastic.clients.elasticsearch.ElasticsearchClient;\nimport fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\n\nimport static fr.pilato.spring.elasticsearch.it.annotation.rest.RestAppConfig.enrichFactoryWithNodeSettings;\n\n@Configuration\npublic class AppConfig {\n\n\t@Bean\n\tpublic ElasticsearchClient esClient() throws Exception {\n\t\tElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\n\t\tenrichFactoryWithNodeSettings(factory);\n\t\tfactory.setClasspathRoot(\"/models/root/update-settings-disabled-31/client1\");\n\t\tfactory.afterPropertiesSet();\n\t\treturn factory.getObject();\n\t}\n\n\t@Bean\n\tpublic ElasticsearchClient esClient2() throws Exception {\n\t\tElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();\n\t\tenrichFactoryWithNodeSettings(factory);\n\t\tfactory.setClasspathRoot(\"/models/root/update-settings-disabled-31/client2\");\n\t\tfactory.setMergeSettings(true);\n\t\tfactory.afterPropertiesSet();\n\t\treturn factory.getObject();\n\t}\n\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/it/annotation/rest/updatesettingsenabled31/UpdateSettings31Test.java",
    "content": "/*\n * Licensed to David Pilato (the \"Author\") under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. Author licenses this\n * file to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage fr.pilato.spring.elasticsearch.it.annotation.rest.updatesettingsenabled31;\n\nimport fr.pilato.spring.elasticsearch.it.annotation.rest.AbstractRestAnnotationContextModel;\n\npublic class UpdateSettings31Test extends AbstractRestAnnotationContextModel {\n\n    @Override\n    protected int expectedShards() {\n        return 2;\n    }\n\n}\n"
  },
  {
    "path": "src/test/java/fr/pilato/spring/elasticsearch/unit/ClassPathReaderTest.java",
    "content": "package fr.pilato.spring.elasticsearch.unit;\n\nimport fr.pilato.elasticsearch.tools.util.SettingsReader;\nimport org.junit.jupiter.api.Test;\n\nimport static org.hamcrest.MatcherAssert.assertThat;\nimport static org.hamcrest.Matchers.nullValue;\nimport static org.hamcrest.Matchers.startsWith;\n\nclass ClassPathReaderTest {\n\n    @Test\n    void testReadFileInClasspath_ExpectFileReadOk() {\n        String url = \"classpath-reader-test.txt\";\n        String contents = SettingsReader.readFileFromClasspath(url);\n        assertThat(contents, startsWith(\"This file is here for testing purposes\"));\n    }\n\n    @Test\n    void testReadFileInClasspath_ExpectFileNotFound_ReturnsNull() {\n        String url = \"__unknown_file_path_____\";\n        String contents = SettingsReader.readFileFromClasspath(url);\n        assertThat(contents, nullValue());\n    }\n}\n"
  },
  {
    "path": "src/test/resources/classpath-reader-test.txt",
    "content": "This file is here for testing purposes. Please don't delete. :)"
  },
  {
    "path": "src/test/resources/es/twitter/_settings.json",
    "content": "{\r\n  \"mappings\": {\r\n    \"properties\" : {\r\n      \"message\" : {\"type\" : \"text\", \"store\" : true}\r\n    }\r\n  }\r\n}\r\n"
  },
  {
    "path": "src/test/resources/log4j2.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- Licensed to David Pilato (the \"Author\") under one or more contributor\n\tlicense agreements. See the NOTICE file distributed with this work for additional\n\tinformation regarding copyright ownership. Author licenses this file to you\n\tunder the Apache License, Version 2.0 (the \"License\"); you may not use this\n\tfile except in compliance with the License. You may obtain a copy of the\n\tLicense at http://www.apache.org/licenses/LICENSE-2.0 Unless required by\n\tapplicable law or agreed to in writing, software distributed under the License\n\tis distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n\tKIND, either express or implied. See the License for the specific language\n\tgoverning permissions and limitations under the License. -->\n<Configuration status=\"fatal\">\n   <Appenders>\n      <Console name=\"CONSOLE\" target=\"SYSTEM_OUT\">\n         <PatternLayout pattern=\"%d{ABSOLUTE} %highlight{%-5p} [%c{1.}] %m%n\"/>\n      </Console>\n   </Appenders>\n   <Loggers>\n      <Logger name=\"fr.pilato.spring.elasticsearch\" level=\"debug\" additivity=\"false\">\n         <AppenderRef ref=\"CONSOLE\"/>\n      </Logger>\n      <Logger name=\"org.elasticsearch\" level=\"warn\" additivity=\"false\">\n         <AppenderRef ref=\"CONSOLE\"/>\n      </Logger>\n      <Logger name=\"org.springframework\" level=\"warn\" additivity=\"false\">\n         <AppenderRef ref=\"CONSOLE\"/>\n      </Logger>\n      <Root level=\"info\">\n         <AppenderRef ref=\"CONSOLE\"/>\n      </Root>\n   </Loggers>\n</Configuration>\n"
  },
  {
    "path": "src/test/resources/models/root/aliases/_aliases.json",
    "content": "{\n  \"actions\" : [\n    { \"remove\": { \"index\": \"test_1\", \"alias\": \"test\" } },\n    { \"add\":  { \"index\": \"test_2\", \"alias\": \"test\" } }\n  ]\n}\n"
  },
  {
    "path": "src/test/resources/models/root/aliases/test_1/_settings.json",
    "content": "{\n  \"mappings\": {\n    \"properties\" : {\n      \"message\" : {\"type\" : \"text\", \"store\" : true}\n    }\n  },\n  \"aliases\": {\n    \"test\": { }\n  }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/aliases/test_2/_settings.json",
    "content": "{\n  \"mappings\": {\n    \"properties\" : {\n      \"message\" : {\"type\" : \"text\", \"store\" : true}\n    }\n  }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/aliases/twitter/_settings.json",
    "content": "{\n  \"mappings\": {\n    \"properties\" : {\n      \"message\" : {\"type\" : \"text\", \"store\" : true}\n    }\n  }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/custom-analyzers-12/client/twitter/_settings.json",
    "content": "{\n\t\"settings\" : {\n\t\t\"analysis\":{\n\t\t\t\"analyzer\":{\n                \"custom_uax_url_email\":{\n                    \"type\":\"custom\",\n                    \"tokenizer\" : \"uax_url_email\",\n                    \"filter\" : [\"lowercase\", \"stop\"]\n                },\n\t\t\t\t\"francais\":{\n\t\t\t\t\t\"type\":\"custom\",\n\t\t\t\t\t\"tokenizer\":\"standard\",\n\t\t\t\t\t\"filter\":[\"lowercase\", \"stop_francais\", \"fr_stemmer\", \"asciifolding\", \"elision\"]\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"filter\":{\n\t\t\t\t\"stop_francais\":{\n\t\t\t\t\t\"type\":\"stop\",\n\t\t\t\t\t\"stopwords\":[\"_french_\"]\n\t\t\t\t},\n\t\t\t\t\"fr_stemmer\" : {\n\t\t\t\t\t\"type\" : \"stemmer\",\n\t\t\t\t\t\"language\" : \"french\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t\"mappings\": {\n\t\t\"properties\" : {\n\t\t\t\"message\" : {\"type\" : \"text\", \"store\" : true, \"analyzer\": \"francais\"},\n\t\t\t\"author\" : {\"type\" : \"text\", \"store\" : false, \"analyzer\": \"custom_uax_url_email\"}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/test/resources/models/root/index-templates/client/_component_templates/component1.json",
    "content": "{\n    \"template\": {\n        \"mappings\": {\n            \"properties\": {\n                \"@timestamp\": {\n                    \"type\": \"date\"\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/index-templates/client/_component_templates/component2.json",
    "content": "{\n    \"template\": {\n        \"mappings\": {\n            \"runtime\": {\n                \"day_of_week\": {\n                    \"type\": \"keyword\",\n                    \"script\": {\n                        \"source\": \"emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))\"\n                    }\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/index-templates/client/_index_templates/template_1.json",
    "content": "{\n    \"index_patterns\": [\"te*\", \"bar*\"],\n    \"template\": {\n        \"settings\": {\n            \"number_of_shards\": 1\n        },\n        \"mappings\": {\n            \"_source\": {\n                \"enabled\": true\n            },\n            \"properties\": {\n                \"host_name\": {\n                    \"type\": \"keyword\"\n                },\n                \"created_at\": {\n                    \"type\": \"date\",\n                    \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n                }\n            }\n        },\n        \"aliases\": {\n            \"mydata\": { }\n        }\n    },\n    \"priority\": 500,\n    \"composed_of\": [\"component1\", \"component2\"],\n    \"version\": 3,\n    \"_meta\": {\n        \"description\": \"my custom\"\n    }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/index-with-type/client/twitter/_doc.json",
    "content": "{\n    \"properties\" : {\n        \"message\" : {\"type\" : \"text\", \"store\" : true}\n    }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/indices-already-exist-86/client/badindex/_settings.json",
    "content": "{\n  \"settings\": {\n    \"number_of_shards\" :   2,\n    \"number_of_replicas\" : 2\n  },\n  \"mappings\": {\n    \"properties\" : {\n      \"foo\" : {\"type\" : \"text\"}\n    }\n  }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/indices-already-exist-86/client/twitter/_settings.json",
    "content": "{\n    \"mappings\": {\n        \"properties\" : {\n            \"message\" : {\"type\" : \"text\", \"store\" : true}\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/lifecycles/_index_lifecycles/policy1.json",
    "content": "{\n  \"policy\": {\n    \"phases\": {\n      \"warm\": {\n        \"min_age\": \"10d\",\n        \"actions\": {\n          \"forcemerge\": {\n            \"max_num_segments\": 1\n          }\n        }\n      },\n      \"delete\": {\n        \"min_age\": \"30d\",\n        \"actions\": {\n          \"delete\": {}\n        }\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/lifecycles/twitter/_settings.json",
    "content": "{\n\t\"settings\" : {\n\t\t\"index.lifecycle.name\": \"policy1\"\n\t}\n}\n"
  },
  {
    "path": "src/test/resources/models/root/manual-settings/_aliases.json",
    "content": "{\n  \"actions\" : [\n    { \"add\":  { \"index\": \"twitter\", \"alias\": \"alias\" } }\n  ]\n}\n"
  },
  {
    "path": "src/test/resources/models/root/manual-settings/_component_templates/component1.json",
    "content": "{\n    \"template\": {\n        \"mappings\": {\n            \"properties\": {\n                \"@timestamp\": {\n                    \"type\": \"date\"\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/manual-settings/_component_templates/component2.json",
    "content": "{\n    \"template\": {\n        \"mappings\": {\n            \"runtime\": {\n                \"day_of_week\": {\n                    \"type\": \"keyword\",\n                    \"script\": {\n                        \"source\": \"emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))\"\n                    }\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/manual-settings/_index_templates/template_1.json",
    "content": "{\n    \"index_patterns\": [\"te*\", \"bar*\"],\n    \"template\": {\n        \"settings\": {\n            \"number_of_shards\": 1\n        }\n    },\n    \"priority\": 100,\n    \"composed_of\": [\"component1\"],\n    \"version\": 1,\n    \"_meta\": {\n        \"description\": \"my custom\"\n    }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/manual-settings/_index_templates/template_2.json",
    "content": "{\n    \"index_patterns\": [\"te*\", \"bar*\"],\n    \"template\": {\n        \"settings\": {\n            \"number_of_shards\": 1\n        }\n    },\n    \"priority\": 100,\n    \"composed_of\": [\"component1\"],\n    \"version\": 1,\n    \"_meta\": {\n        \"description\": \"my custom should be ignored\"\n    }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/manual-settings/_pipelines/pipeline1.json",
    "content": "{\n  \"description\": \"My optional pipeline1 description\",\n  \"processors\": [\n  ]\n}\n"
  },
  {
    "path": "src/test/resources/models/root/manual-settings/_pipelines/pipeline2.json",
    "content": "{\n  \"description\": \"My optional pipeline2 description\",\n  \"processors\": [\n  ]\n}\n"
  },
  {
    "path": "src/test/resources/models/root/manual-settings/foobar/_settings.json",
    "content": "{\n\n}\n"
  },
  {
    "path": "src/test/resources/models/root/mapping/client1/twitter/_settings.json",
    "content": "{\n\t\"settings\" : {\n\t\t\"analysis\":{\n\t\t\t\"analyzer\":{\n\t\t\t\t\"francais\":{\n\t\t\t\t\t\"type\":\"custom\",\n\t\t\t\t\t\"tokenizer\":\"standard\",\n\t\t\t\t\t\"filter\":[\"lowercase\", \"stop_francais\", \"fr_stemmer\", \"asciifolding\", \"elision\"]\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"filter\":{\n\t\t\t\t\"stop_francais\":{\n\t\t\t\t\t\"type\":\"stop\",\n\t\t\t\t\t\"stopwords\":[\"_french_\"]\n\t\t\t\t},\n\t\t\t\t\"fr_stemmer\" : {\n\t\t\t\t\t\"type\" : \"stemmer\",\n\t\t\t\t\t\"language\" : \"french\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t\"mappings\": {\n\t\t\"properties\" : {\n\t\t\t\"message\" : {\"type\" : \"text\", \"store\" : true, \"analyzer\" : \"francais\" }\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/test/resources/models/root/mapping/client2/twitter/_settings.json",
    "content": "{\n\t\"settings\" : {\n\t\t\"analysis\":{\n\t\t\t\"analyzer\":{\n\t\t\t\t\"francais\":{\n\t\t\t\t\t\"type\":\"custom\",\n\t\t\t\t\t\"tokenizer\":\"standard\",\n\t\t\t\t\t\"filter\":[\"lowercase\", \"stop_francais\", \"fr_stemmer\", \"asciifolding\", \"elision\"]\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"filter\":{\n\t\t\t\t\"stop_francais\":{\n\t\t\t\t\t\"type\":\"stop\",\n\t\t\t\t\t\"stopwords\":[\"_french_\"]\n\t\t\t\t},\n\t\t\t\t\"fr_stemmer\" : {\n\t\t\t\t\t\"type\" : \"stemmer\",\n\t\t\t\t\t\"language\" : \"french\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t\"mappings\": {\n\t\t\"properties\" : {\n\t\t\t\"message\" : {\"type\" : \"text\", \"store\" : true, \"analyzer\" : \"francais\" },\n\t\t\t\"author\" : {\"type\" : \"text\", \"store\" : false}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/test/resources/models/root/mapping-failed/client1/twitter/_settings.json",
    "content": "{\n\t\"mappings\": {\n\t\t\"properties\" : {\n\t\t\t\"message\" : {\"type\" : \"text\" }\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/test/resources/models/root/mapping-failed/client2/twitter/_update_settings.json",
    "content": "{\n\t\"mappings\": {\n\t\t\"properties\" : {\n\t\t\t\"message\" : {\"type\" : \"date\"}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/test/resources/models/root/multiple-clients/client1/twitter/_settings.json",
    "content": "{\n\t\"settings\" : {\n\t\t\"analysis\":{\n\t\t\t\"analyzer\":{\n\t\t\t\t\"francais\":{\n\t\t\t\t\t\"type\":\"custom\",\n\t\t\t\t\t\"tokenizer\":\"standard\",\n\t\t\t\t\t\"filter\":[\"lowercase\", \"stop_francais\", \"fr_stemmer\", \"asciifolding\", \"elision\"]\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"filter\":{\n\t\t\t\t\"stop_francais\":{\n\t\t\t\t\t\"type\":\"stop\",\n\t\t\t\t\t\"stopwords\":[\"_french_\"]\n\t\t\t\t},\n\t\t\t\t\"fr_stemmer\" : {\n\t\t\t\t\t\"type\" : \"stemmer\",\n\t\t\t\t\t\"language\" : \"french\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t\"mappings\": {\n\t\t\"properties\" : {\n\t\t\t\"message\" : {\"type\" : \"text\", \"store\" : true, \"analyzer\" : \"francais\" }\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/test/resources/models/root/multiple-clients/client2/twitter/_settings.json",
    "content": "{\n    \"settings\" : {\n        \"number_of_replicas\" : 4,\n        \"analysis\" : {\n            \"analyzer\":{\n                \"mysimple\":{\n                    \"type\":\"simple\"\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/no-namespace/client/rss/_settings.json",
    "content": "{\n\t\"settings\" : {\n\t\t\"analysis\":{\n\t\t\t\"analyzer\":{\n\t\t\t\t\"francais\":{\n\t\t\t\t\t\"type\":\"custom\",\n\t\t\t\t\t\"tokenizer\":\"standard\",\n\t\t\t\t\t\"filter\":[\"lowercase\", \"stop_francais\", \"fr_stemmer\", \"asciifolding\", \"elision\"]\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"filter\":{\n\t\t\t\t\"stop_francais\":{\n\t\t\t\t\t\"type\":\"stop\",\n\t\t\t\t\t\"stopwords\":[\"_french_\"]\n\t\t\t\t},\n\t\t\t\t\"fr_stemmer\" : {\n\t\t\t\t\t\"type\" : \"stemmer\",\n\t\t\t\t\t\"name\" : \"french\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t\"mappings\": {\n\t\t\"properties\" : {\n\t\t\t\"message\" : {\"type\" : \"text\", \"store\" : true, \"analyzer\" : \"francais\" },\n\t\t\t\"author\" : {\"type\" : \"text\", \"store\" : false}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/test/resources/models/root/no-namespace/client/twitter/_settings.json",
    "content": "{\n\t\"settings\" : {\n\t\t\"analysis\":{\n\t\t\t\"analyzer\":{\n\t\t\t\t\"francais\":{\n\t\t\t\t\t\"type\":\"custom\",\n\t\t\t\t\t\"tokenizer\":\"standard\",\n\t\t\t\t\t\"filter\":[\"lowercase\", \"stop_francais\", \"fr_stemmer\", \"asciifolding\", \"elision\"]\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"filter\":{\n\t\t\t\t\"stop_francais\":{\n\t\t\t\t\t\"type\":\"stop\",\n\t\t\t\t\t\"stopwords\":[\"_french_\"]\n\t\t\t\t},\n\t\t\t\t\"fr_stemmer\" : {\n\t\t\t\t\t\"type\" : \"stemmer\",\n\t\t\t\t\t\"name\" : \"french\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t\"mappings\": {\n\t\t\"properties\" : {\n\t\t\t\"message\" : {\"type\" : \"text\", \"store\" : true, \"analyzer\" : \"francais\" },\n\t\t\t\"author\" : {\"type\" : \"text\", \"store\" : false}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/test/resources/models/root/pipelines/_pipelines/pipeline1.json",
    "content": "{\n  \"description\": \"My optional pipeline description\",\n  \"processors\": [\n    {\n      \"set\": {\n        \"description\": \"My optional processor description\",\n        \"field\": \"my-long-field\",\n        \"value\": 10\n      }\n    },\n    {\n      \"set\": {\n        \"description\": \"Set 'my-boolean-field' to true\",\n        \"field\": \"my-boolean-field\",\n        \"value\": true\n      }\n    },\n    {\n      \"lowercase\": {\n        \"field\": \"my-keyword-field\"\n      }\n    }\n  ]\n}\n"
  },
  {
    "path": "src/test/resources/models/root/plugins/client/twitter/_doc.json",
    "content": "{\n    \"properties\" : {\n        \"message\" : {\"type\" : \"text\", \"store\" : true, \"analyzer\" : \"francais\" },\n        \"author\" : {\"type\" : \"text\", \"store\" : false}\n    }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/plugins/client/twitter/_settings.json",
    "content": "{\n\t\"settings\" : {\n\t\t\"analysis\":{\n\t\t\t\"analyzer\":{\n\t\t\t\t\"francais\":{\n\t\t\t\t\t\"type\":\"custom\",\n\t\t\t\t\t\"tokenizer\":\"standard\",\n\t\t\t\t\t\"filter\":[\"lowercase\", \"stop_francais\", \"fr_stemmer\", \"asciifolding\", \"elision\"]\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"filter\":{\n\t\t\t\t\"stop_francais\":{\n\t\t\t\t\t\"type\":\"stop\",\n\t\t\t\t\t\"stopwords\":[\"_french_\"]\n\t\t\t\t},\n\t\t\t\t\"fr_stemmer\" : {\n\t\t\t\t\t\"type\" : \"stemmer\",\n\t\t\t\t\t\"name\" : \"french\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/test/resources/models/root/rest-client-namespace/client/twitter/_settings.json",
    "content": "{\n  \"mappings\": {\n    \"properties\" : {\n      \"message\" : {\"type\" : \"text\", \"store\" : true}\n    }\n  }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/settings-13/client/rss/_settings.json",
    "content": "{\n\t\"settings\" : {\n\t\t\"analysis\":{\n\t\t\t\"analyzer\":{\n\t\t\t\t\"francais\":{\n\t\t\t\t\t\"type\":\"custom\",\n\t\t\t\t\t\"tokenizer\":\"standard\",\n\t\t\t\t\t\"filter\":[\"lowercase\", \"stop_francais\", \"fr_stemmer\", \"asciifolding\", \"elision\"]\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"filter\":{\n\t\t\t\t\"stop_francais\":{\n\t\t\t\t\t\"type\":\"stop\",\n\t\t\t\t\t\"stopwords\":[\"_french_\"]\n\t\t\t\t},\n\t\t\t\t\"fr_stemmer\" : {\n\t\t\t\t\t\"type\" : \"stemmer\",\n\t\t\t\t\t\"language\" : \"french\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t\"mappings\": {\n\t\t\"properties\" : {\n\t\t\t\"message\" : {\"type\" : \"text\", \"store\" : true, \"analyzer\" : \"francais\" },\n\t\t\t\"author\" : {\"type\" : \"text\", \"store\" : false}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/test/resources/models/root/settings-13/client/twitter/_settings.json",
    "content": "{\n\t\"settings\" : {\n\t\t\"analysis\":{\n\t\t\t\"analyzer\":{\n\t\t\t\t\"francais\":{\n\t\t\t\t\t\"type\":\"custom\",\n\t\t\t\t\t\"tokenizer\":\"standard\",\n\t\t\t\t\t\"filter\":[\"lowercase\", \"stop_francais\", \"fr_stemmer\", \"asciifolding\", \"elision\"]\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"filter\":{\n\t\t\t\t\"stop_francais\":{\n\t\t\t\t\t\"type\":\"stop\",\n\t\t\t\t\t\"stopwords\":[\"_french_\"]\n\t\t\t\t},\n\t\t\t\t\"fr_stemmer\" : {\n\t\t\t\t\t\"type\" : \"stemmer\",\n\t\t\t\t\t\"language\" : \"french\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t\"mappings\": {\n\t\t\"properties\" : {\n\t\t\t\"message\" : {\"type\" : \"text\", \"store\" : true, \"analyzer\" : \"francais\" },\n\t\t\t\"author\" : {\"type\" : \"text\", \"store\" : false}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/test/resources/models/root/settings-failed/client1/twitter/_settings.json",
    "content": "{\n\t\"settings\" : {\n\t\t\"index\" : {\n\t\t\t\"number_of_shards\" : 1\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/test/resources/models/root/settings-failed/client2/twitter/_update_settings.json",
    "content": "{\n    \"index\" : {\n        \"number_of_shards\" : 4\n    }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/settings-no-mapping-21/client/twitter/_settings.json",
    "content": "{\n}"
  },
  {
    "path": "src/test/resources/models/root/shards/client/twitter/_settings.json",
    "content": "{\n  \"settings\" : {\n    \"number_of_shards\" : 3,\n    \"number_of_replicas\" : 2\n  }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/update-settings-31/client1/twitter/_settings.json",
    "content": "{\n  \"settings\" : {\n      \"number_of_shards\" : 2,\n      \"number_of_replicas\" : 0\n  },\n  \"mappings\": {\n    \"properties\" : {\n      \"message\" : {\"type\" : \"text\", \"store\" : true, \"analyzer\" : \"simple\" }\n    }\n  }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/update-settings-31/client2/twitter/_update_settings.json",
    "content": "{\n    \"index\" : {\n        \"number_of_replicas\" : 1\n    }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/update-settings-disabled-31/client1/twitter/_settings.json",
    "content": "{\n  \"settings\" : {\n      \"number_of_shards\" : 2,\n      \"number_of_replicas\" : 0\n  },\n  \"mappings\": {\n    \"properties\" : {\n      \"message\" : {\"type\" : \"text\", \"store\" : true, \"analyzer\" : \"simple\" }\n    }\n  }\n}\n"
  },
  {
    "path": "src/test/resources/models/root/update-settings-disabled-31/client2/twitter/_update_settings.json",
    "content": "{\n    \"index\" : {\n        \"number_of_replicas\" : 1\n    }\n}\n"
  }
]