Skip to content

Commit 56b94b7

Browse files
committed
Releasing zentity-1.0.1. Zentity will be tested and built for Elasticsearch versions 6.5.0 and above from here on out.
1 parent 861b2f8 commit 56b94b7

File tree

8 files changed

+18
-32
lines changed

8 files changed

+18
-32
lines changed

.travis.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,8 @@ jdk:
33
- oraclejdk8
44
env:
55
matrix:
6-
- ELASTICSEARCH_VERSION=6.2.4
7-
- ELASTICSEARCH_VERSION=6.2.3
8-
- ELASTICSEARCH_VERSION=6.2.2
9-
- ELASTICSEARCH_VERSION=6.2.1
10-
- ELASTICSEARCH_VERSION=6.2.0
11-
- ELASTICSEARCH_VERSION=6.1.3
12-
- ELASTICSEARCH_VERSION=6.1.2
13-
- ELASTICSEARCH_VERSION=6.1.1
14-
- ELASTICSEARCH_VERSION=6.0.1
15-
- ELASTICSEARCH_VERSION=6.0.0
6+
- ELASTICSEARCH_VERSION=6.5.1
7+
- ELASTICSEARCH_VERSION=6.5.0
168

179
script: "mvn clean install -Delasticsearch.version=${ELASTICSEARCH_VERSION}"
1810

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Once you have installed Elasticsearch, you can install zentity from a remote URL
3131

3232
Example:
3333

34-
`elasticsearch-plugin install https://zentity.io/releases/zentity-1.0.0-elasticsearch-6.2.4.zip`
34+
`elasticsearch-plugin install https://zentity.io/releases/zentity-1.0.1-elasticsearch-6.5.1.zip`
3535

3636
Read the [installation](https://zentity.io/docs/installation) docs for more details.
3737

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
<zentity.author>Dave Moore</zentity.author>
1515
<zentity.classname>org.elasticsearch.plugin.zentity.ZentityPlugin</zentity.classname>
1616
<zentity.website>https://zentity.io</zentity.website>
17-
<zentity.version>1.0.0</zentity.version>
17+
<zentity.version>1.0.1</zentity.version>
1818
<!-- dependency versions -->
19-
<elasticsearch.version>6.2.4</elasticsearch.version>
19+
<elasticsearch.version>6.5.1</elasticsearch.version>
2020
<jackson.version>2.9.4</jackson.version>
2121
<jdk.version>1.8</jdk.version>
2222
<log4j.version>2.9.1</log4j.version>
@@ -176,7 +176,7 @@
176176
<artifactItems>
177177
<artifactItem>
178178
<groupId>org.elasticsearch.distribution.zip</groupId>
179-
<artifactId>elasticsearch</artifactId>
179+
<artifactId>elasticsearch-oss</artifactId>
180180
<version>${elasticsearch.version}</version>
181181
<type>zip</type>
182182
</artifactItem>

src/main/assemblies/plugin.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
<files>
99
<file>
1010
<source>${project.basedir}/src/main/resources/plugin-descriptor.properties</source>
11-
<outputDirectory>elasticsearch</outputDirectory>
11+
<outputDirectory>/</outputDirectory>
1212
<filtered>true</filtered>
1313
</file>
1414
</files>
1515
<dependencySets>
1616
<dependencySet>
17-
<outputDirectory>elasticsearch</outputDirectory>
17+
<outputDirectory>/</outputDirectory>
1818
<useProjectArtifact>true</useProjectArtifact>
1919
<useTransitiveFiltering>true</useTransitiveFiltering>
2020
</dependencySet>

src/main/java/io/zentity/resolution/Job.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.elasticsearch.action.search.SearchResponse;
1717
import org.elasticsearch.client.node.NodeClient;
1818
import org.elasticsearch.common.settings.Settings;
19+
import org.elasticsearch.common.xcontent.DeprecationHandler;
1920
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
2021
import org.elasticsearch.common.xcontent.XContentFactory;
2122
import org.elasticsearch.common.xcontent.XContentParser;
@@ -109,7 +110,7 @@ public static String makeScriptFieldsClause(Input input, String indexName) throw
109110
}
110111

111112
// Make the "script" clause
112-
String scriptSource = "doc[params.field].value.toString(params.format)";
113+
String scriptSource = "DateFormat df = new SimpleDateFormat(params.format); df.setTimeZone(TimeZone.getTimeZone('UTC')); return df.format(doc[params.field].value.toInstant().toEpochMilli())";
113114
String scriptParams = "\"field\":\"" + indexFieldName + "\",\"format\":\"" + format + "\"";
114115
String scriptFieldClause = "\"" + indexFieldName + "\":{\"script\":{\"lang\":\"painless\",\"source\":\"" + scriptSource + "\",\"params\":{" + scriptParams + "}}}";
115116
scriptFieldClauses.add(scriptFieldClause);
@@ -509,7 +510,7 @@ private SearchResponse search(String indexName, String query) throws IOException
509510
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
510511
SearchModule searchModule = new SearchModule(Settings.EMPTY, false, Collections.emptyList());
511512
try (XContentParser parser = XContentFactory.xContent(XContentType.JSON).createParser(new NamedXContentRegistry(searchModule
512-
.getNamedXContents()), query)) {
513+
.getNamedXContents()), DeprecationHandler.THROW_UNSUPPORTED_OPERATION, query)) {
513514
searchSourceBuilder.parseXContent(parser);
514515
}
515516
SearchRequestBuilder searchRequestBuilder = new SearchRequestBuilder(client, SearchAction.INSTANCE);

src/test/ant/integration-tests.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@
238238
<target name="setup-workspace" depends="stop-external-cluster">
239239
<sequential>
240240
<delete dir="${project.build.directory}/integration-tests/run"/>
241-
<unzip src="${project.build.directory}/integration-tests/binaries/elasticsearch-${elasticsearch.version}.zip"
241+
<unzip src="${project.build.directory}/integration-tests/binaries/elasticsearch-oss-${elasticsearch.version}.zip"
242242
dest="${project.build.directory}/integration-tests/run"/>
243243
</sequential>
244244
</target>

src/test/java/io/zentity/resolution/AbstractITCase.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
import com.fasterxml.jackson.databind.JsonNode;
44
import io.zentity.common.Json;
55
import org.apache.http.HttpHost;
6-
import org.apache.logging.log4j.Logger;
76
import org.elasticsearch.client.Response;
87
import org.elasticsearch.client.RestClient;
9-
import org.elasticsearch.common.logging.ESLoggerFactory;
108
import org.elasticsearch.test.ESTestCase;
119
import org.junit.AfterClass;
1210
import org.junit.BeforeClass;
@@ -18,7 +16,6 @@
1816
import static org.junit.Assume.assumeThat;
1917

2018
public abstract class AbstractITCase extends ESTestCase {
21-
protected static final Logger logger = ESLoggerFactory.getLogger("it");
2219
protected final static int HTTP_TEST_PORT = 9400;
2320
protected static RestClient client;
2421

@@ -29,12 +26,9 @@ public static void startRestClient() throws IOException {
2926
Response response = client.performRequest("GET", "/");
3027
JsonNode json = Json.MAPPER.readTree(response.getEntity().getContent());
3128
assertTrue(json.get("tagline").textValue().equals("You Know, for Search"));
32-
logger.info("Integration tests ready to start... Cluster is running.");
3329
} catch (IOException e) {
3430
// If we have an exception here, let's ignore the test
35-
logger.warn("Integration tests are skipped: [{}]", e.getMessage());
3631
assumeThat("Integration tests are skipped", e.getMessage(), not(containsString("Connection refused")));
37-
logger.error("Full error is", e);
3832
fail("Something wrong is happening. REST Client seemed to raise an exception.");
3933
if (client != null) {
4034
client.close();
@@ -49,6 +43,5 @@ public static void stopRestClient() throws IOException {
4943
client.close();
5044
client = null;
5145
}
52-
logger.info("Stopping integration tests against an external cluster");
5346
}
5447
}

src/test/java/io/zentity/resolution/JobTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public void testMakeScriptFieldsClauseTypeDateFormatInputAttributeOnly() throws
300300
"}";
301301
Input input = new Input(json, model);
302302
String scriptFieldsClause = Job.makeScriptFieldsClause(input, "index");
303-
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"doc[params.field].value.toString(params.format)\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd\"}}}}";
303+
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"DateFormat df = new SimpleDateFormat(params.format); df.setTimeZone(TimeZone.getTimeZone('UTC')); return df.format(doc[params.field].value.toInstant().toEpochMilli())\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd\"}}}}";
304304
Assert.assertEquals(scriptFieldsClause, expected);
305305
}
306306

@@ -366,7 +366,7 @@ public void testMakeScriptFieldsClauseTypeDateFormatMatcherOnly() throws Excepti
366366
"}";
367367
Input input = new Input(json, model);
368368
String scriptFieldsClause = Job.makeScriptFieldsClause(input, "index");
369-
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"doc[params.field].value.toString(params.format)\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd\"}}}}";
369+
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"DateFormat df = new SimpleDateFormat(params.format); df.setTimeZone(TimeZone.getTimeZone('UTC')); return df.format(doc[params.field].value.toInstant().toEpochMilli())\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd\"}}}}";
370370
Assert.assertEquals(scriptFieldsClause, expected);
371371
}
372372

@@ -428,7 +428,7 @@ public void testMakeScriptFieldsClauseTypeDateFormatModelAttributeOnly() throws
428428
"}";
429429
Input input = new Input(json, model);
430430
String scriptFieldsClause = Job.makeScriptFieldsClause(input, "index");
431-
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"doc[params.field].value.toString(params.format)\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd\"}}}}";
431+
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"DateFormat df = new SimpleDateFormat(params.format); df.setTimeZone(TimeZone.getTimeZone('UTC')); return df.format(doc[params.field].value.toInstant().toEpochMilli())\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd\"}}}}";
432432
Assert.assertEquals(scriptFieldsClause, expected);
433433
}
434434

@@ -493,7 +493,7 @@ public void testMakeScriptFieldsClauseTypeDateFormatModelAttributeOverridesMatch
493493
"}";
494494
Input input = new Input(json, model);
495495
String scriptFieldsClause = Job.makeScriptFieldsClause(input, "index");
496-
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"doc[params.field].value.toString(params.format)\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd'T'HH:mm:ss\"}}}}";
496+
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"DateFormat df = new SimpleDateFormat(params.format); df.setTimeZone(TimeZone.getTimeZone('UTC')); return df.format(doc[params.field].value.toInstant().toEpochMilli())\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd'T'HH:mm:ss\"}}}}";
497497
Assert.assertEquals(scriptFieldsClause, expected);
498498
}
499499

@@ -560,7 +560,7 @@ public void testMakeScriptFieldsClauseTypeDateFormatInputAttributeOverridesModel
560560
"}";
561561
Input input = new Input(json, model);
562562
String scriptFieldsClause = Job.makeScriptFieldsClause(input, "index");
563-
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"doc[params.field].value.toString(params.format)\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd'T'HH:mm:ss.SSS\"}}}}";
563+
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"DateFormat df = new SimpleDateFormat(params.format); df.setTimeZone(TimeZone.getTimeZone('UTC')); return df.format(doc[params.field].value.toInstant().toEpochMilli())\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd'T'HH:mm:ss.SSS\"}}}}";
564564
Assert.assertEquals(scriptFieldsClause, expected);
565565
}
566566

@@ -627,7 +627,7 @@ public void testMakeScriptFieldsClauseTypeDateFormatNullNotOverrides() throws Ex
627627
"}";
628628
Input input = new Input(json, model);
629629
String scriptFieldsClause = Job.makeScriptFieldsClause(input, "index");
630-
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"doc[params.field].value.toString(params.format)\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd'T'HH:mm:ss\"}}}}";
630+
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"DateFormat df = new SimpleDateFormat(params.format); df.setTimeZone(TimeZone.getTimeZone('UTC')); return df.format(doc[params.field].value.toInstant().toEpochMilli())\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd'T'HH:mm:ss\"}}}}";
631631
Assert.assertEquals(scriptFieldsClause, expected);
632632
}
633633

0 commit comments

Comments
 (0)