Skip to content

Commit ec26976

Browse files
committed
Update to Elasticsearch 7.0.0-beta1
Note this is not a complete work as it will require elastic/elasticsearch#38944 to be fixed first.
1 parent b4f6b0e commit ec26976

File tree

22 files changed

+108
-606
lines changed

22 files changed

+108
-606
lines changed

README.md

Lines changed: 23 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ Versions
1111

1212
| elasticsearch-beyonder | elasticsearch | Release date |
1313
|:-----------------------:|:-------------:|:------------:|
14-
| 6.5 | 6.5 -> 6.x | 2019-01-04 |
15-
| 6.3 | 6.3 -> 6.4 | 2018-07-21 |
16-
| 6.0 | 6.0 -> 6.2 | 2018-02-05 |
17-
| 5.1 | 5.x | 2017-07-12 |
18-
| 5.0 | 5.x | 2017-07-11 |
14+
| 7.0-SNAPSHOT | 7.x | |
15+
| 6.5-SNAPSHOT | 6.x | |
16+
| 5.1 | 5.x, 6.x | 2017-07-12 |
17+
| 5.0 | 5.x, 6.x | 2017-07-11 |
1918
| 2.1.0 | 2.0, 2.1 | 2015-11-25 |
2019
| 2.0.0 | 2.0 | 2015-10-24 |
2120
| 1.5.0 | 1.5 | 2015-03-27 |
@@ -26,7 +25,8 @@ Versions
2625
Documentation
2726
=============
2827

29-
* For 6.x elasticsearch versions, you are reading the latest documentation.
28+
* For 7.x elasticsearch versions, you are reading the latest documentation.
29+
* For 6.x elasticsearch versions, look at [master branch](https://github.com/dadoonet/elasticsearch-beyonder/tree/master).
3030
* For 5.x elasticsearch versions, look at [es-5.x branch](https://github.com/dadoonet/elasticsearch-beyonder/tree/es-5.x).
3131
* For 2.x elasticsearch versions, look at [es-2.1 branch](https://github.com/dadoonet/elasticsearch-beyonder/tree/es-2.1).
3232

@@ -49,7 +49,7 @@ Import elasticsearch-beyonder in you project `pom.xml` file:
4949
<dependency>
5050
<groupId>fr.pilato.elasticsearch</groupId>
5151
<artifactId>elasticsearch-beyonder</artifactId>
52-
<version>6.5</version>
52+
<version>7.0-SNAPSHOT</version>
5353
</dependency>
5454
```
5555

@@ -62,7 +62,7 @@ For example, here is how to import the REST Client to your project:
6262
<dependency>
6363
<groupId>org.elasticsearch.client</groupId>
6464
<artifactId>elasticsearch-rest-client</artifactId>
65-
<version>6.5.3</version>
65+
<version>7.0.0-beta1</version>
6666
</dependency>
6767
```
6868

@@ -72,21 +72,10 @@ For example, here is how to import the Transport Client to your project (depreca
7272
<dependency>
7373
<groupId>org.elasticsearch.client</groupId>
7474
<artifactId>transport</artifactId>
75-
<version>6.5.3</version>
75+
<version>7.0.0-beta1</version>
7676
</dependency>
7777
```
7878

79-
For example, here is how to import the Secured Transport Client to your project (deprecated):
80-
81-
```xml
82-
<dependency>
83-
<groupId>org.elasticsearch.client</groupId>
84-
<artifactId>x-pack-transport</artifactId>
85-
<version>6.5.3</version>
86-
</dependency>
87-
```
88-
89-
9079

9180
Adding Beyonder to your client
9281
------------------------------
@@ -114,7 +103,7 @@ In that case, Beyonder will search for resources from `models/myelasticsearch`.
114103

115104
## Using REST Client (recommended)
116105

117-
Elasticsearch now provides a [Rest Client](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.5/index.html).
106+
Elasticsearch provides a [Rest Client](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/7.0/index.html).
118107
It's the recommended way as the Transport Client is now deprecated and will be removed in a next major version.
119108

120109
Just pass to Beyonder a Rest Client instance:
@@ -149,16 +138,6 @@ Client client = new PreBuiltTransportClient(Settings.EMPTY)
149138
ElasticsearchBeyonder.start(client);
150139
```
151140

152-
## Using Secured Transport Client (deprecated)
153-
154-
To use the deprecated TransportClient, just pass it to Beyonder:
155-
156-
```java
157-
Client client = new PreBuiltXPackTransportClient(Settings.builder().put("xpack.security.user", "elastic:changeme").build())
158-
.addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress("127.0.0.1", 9300)));
159-
ElasticsearchBeyonder.start(client);
160-
```
161-
162141
Managing indices
163142
----------------
164143

@@ -174,9 +153,16 @@ For example, create the following file `src/main/resources/elasticsearch/twitter
174153

175154
```javascript
176155
{
177-
"settings" : {
178-
"number_of_shards" : 3,
179-
"number_of_replicas" : 2
156+
"settings": {
157+
"number_of_shards": 3,
158+
"number_of_replicas": 2
159+
},
160+
"mappings": {
161+
"properties": {
162+
"message": {
163+
"type": "text"
164+
}
165+
}
180166
}
181167
}
182168
```
@@ -185,31 +171,6 @@ By default, Beyonder will not overwrite an index if it already exists.
185171
This can be overridden by setting `force` to `true` in the expanded factory method
186172
`ElasticsearchBeyonder.start()`.
187173

188-
Managing types (deprecated)
189-
---------------------------
190-
191-
This feature will be removed in the next future. Define your mapping within the index settings (see above)
192-
or using a template (see below).
193-
194-
If you define a file named `elasticsearch/twitter/tweet.json`, it will be automatically applied as the mapping for
195-
the `tweet` type in the `twitter` index.
196-
197-
For example, create the following file `src/main/resources/elasticsearch/twitter/tweet.json` in your project:
198-
199-
```javascript
200-
{
201-
"tweet" : {
202-
"properties" : {
203-
"message" : {"type" : "string", "store" : "yes"}
204-
}
205-
}
206-
}
207-
```
208-
209-
By default, Beyonder will attempt to merge defined mappings with existing ones.
210-
This can be overridden by setting `merge` to `false` in the expanded factory method
211-
`ElasticsearchBeyonder.start()`.
212-
213174
Managing templates
214175
------------------
215176

@@ -226,12 +187,9 @@ in your project:
226187
"number_of_shards" : 1
227188
},
228189
"mappings" : {
229-
"tweet" : {
230-
"properties" : {
231-
"message" : {
232-
"type" : "string",
233-
"store" : "yes"
234-
}
190+
"properties" : {
191+
"message" : {
192+
"type" : "text"
235193
}
236194
}
237195
}

pom.xml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<groupId>fr.pilato.elasticsearch</groupId>
66
<artifactId>elasticsearch-beyonder</artifactId>
77
<packaging>jar</packaging>
8-
<version>6.6-SNAPSHOT</version>
8+
<version>7.0-SNAPSHOT</version>
99
<name>Elasticsearch Beyonder</name>
1010
<url>https://github.com/dadoonet/elasticsearch-beyonder</url>
1111
<description>
@@ -22,7 +22,7 @@ when an elasticsearch client starts.
2222
</licenses>
2323

2424
<properties>
25-
<elasticsearch.version>6.5.3</elasticsearch.version>
25+
<elasticsearch.version>7.0.0-beta1</elasticsearch.version>
2626
<test.elasticsearch.version>${elasticsearch.version}</test.elasticsearch.version>
2727
<slf4j.version>1.7.25</slf4j.version>
2828
<log4j.version>2.11.1</log4j.version>
@@ -49,7 +49,7 @@ when an elasticsearch client starts.
4949
<connection>scm:git:[email protected]:dadoonet/elasticsearch-beyonder.git</connection>
5050
<developerConnection>scm:git:[email protected]:dadoonet/elasticsearch-beyonder.git</developerConnection>
5151
<tag>HEAD</tag>
52-
</scm>
52+
</scm>
5353

5454
<issueManagement>
5555
<system>GitHub</system>
@@ -96,7 +96,7 @@ when an elasticsearch client starts.
9696
<repository>
9797
<id>elastic-lucene-snapshots</id>
9898
<name>Elastic Lucene Snapshots</name>
99-
<url>http://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/6d9c714052</url>
99+
<url>http://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/83f9835</url>
100100
<releases><enabled>true</enabled></releases>
101101
<snapshots><enabled>false</enabled></snapshots>
102102
</repository>
@@ -110,6 +110,16 @@ when an elasticsearch client starts.
110110
<artifactId>transport</artifactId>
111111
<version>${elasticsearch.version}</version>
112112
<optional>true</optional>
113+
<!--
114+
Temporary workaround to be removed with final 7.0.0
115+
See https://github.com/elastic/elasticsearch/issues/38944
116+
-->
117+
<exclusions>
118+
<exclusion>
119+
<groupId>org.elasticsearch</groupId>
120+
<artifactId>elasticsearch-ssl-config</artifactId>
121+
</exclusion>
122+
</exclusions>
113123
</dependency>
114124
<dependency>
115125
<groupId>org.elasticsearch.client</groupId>
@@ -299,6 +309,9 @@ when an elasticsearch client starts.
299309
<name>dadoonet/docker-elasticsearch:${project.version}</name>
300310
<build>
301311
<from>${integ.elasticsearch.image}:${integ.elasticsearch.version}</from>
312+
<env>
313+
<discovery.type>single-node</discovery.type>
314+
</env>
302315
</build>
303316
<run>
304317
<ports>

src/main/java/fr/pilato/elasticsearch/tools/ElasticsearchBeyonder.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import fr.pilato.elasticsearch.tools.SettingsFinder.Defaults;
2323
import fr.pilato.elasticsearch.tools.index.IndexFinder;
2424
import fr.pilato.elasticsearch.tools.template.TemplateFinder;
25-
import fr.pilato.elasticsearch.tools.type.TypeFinder;
2625
import org.elasticsearch.client.Client;
2726
import org.elasticsearch.client.RestClient;
2827
import org.slf4j.Logger;
@@ -34,7 +33,6 @@
3433
import static fr.pilato.elasticsearch.tools.index.IndexElasticsearchUpdater.createIndex;
3534
import static fr.pilato.elasticsearch.tools.index.IndexElasticsearchUpdater.updateSettings;
3635
import static fr.pilato.elasticsearch.tools.template.TemplateElasticsearchUpdater.createTemplate;
37-
import static fr.pilato.elasticsearch.tools.type.TypeElasticsearchUpdater.createMapping;
3836

3937
/**
4038
* By default, indexes are created with their default Elasticsearch settings. You can specify
@@ -116,13 +114,6 @@ public static void start(RestClient client, String root, boolean merge, boolean
116114
for (String indexName : indexNames) {
117115
createIndex(client, root, indexName, force);
118116
updateSettings(client, root, indexName);
119-
120-
// create types
121-
List<String> types = TypeFinder.findTypes(root, indexName);
122-
for (String typeName : types) {
123-
createMapping(client, root, indexName, typeName, merge);
124-
}
125-
126117
}
127118
logger.info("start done. Rock & roll!");
128119
}
@@ -166,13 +157,6 @@ public static void start(Client client, String root) throws Exception {
166157
for (String indexName : indexNames) {
167158
createIndex(client, root, indexName, force);
168159
updateSettings(client, root, indexName);
169-
170-
// create types
171-
List<String> types = TypeFinder.findTypes(root, indexName);
172-
for (String typeName : types) {
173-
createMapping(client, root, indexName, typeName, merge);
174-
}
175-
176160
}
177161
logger.info("start done. Rock & roll!");
178162
}

0 commit comments

Comments
 (0)