Skip to content

Commit

Permalink
Compatible with Elasticsearch 5.5.3.
Browse files Browse the repository at this point in the history
This one explicitely builds with Maven instead of Gradle.
Those branches will have the -mvn suffix to avoid confusion.
  • Loading branch information
pikatech committed Jan 23, 2019
1 parent f65fa7c commit f7d5864
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ElasticSearch compatibility table:

| elasticsearch | Preanalyzed Mapper Plugin | Docs
|---------------|----------------------------|------
| es-5.5.3 | 5.5.3 | [5.5.3-mvn](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.5.3-mvn)
| es-5.5.0 | 5.5.0 | [5.5.0-mvn](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.5.0-mvn)
| es-5.4.3 | 5.4.3 | [5.4.3-mvn](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.4.3-mvn)
| es-5.4.3 | 5.4.3 | [5.4.3](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.4.3)
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<groupId>de.julielab</groupId>
<artifactId>elasticsearch-mapper-preanalyzed</artifactId>
<name>Plugin: Mapper: Preanalyzed</name>
<version>5.5.0</version>
<version>5.5.3</version>
<properties>
<elasticsearch.plugin.classname>org.elasticsearch.index.plugin.mapper.preanalyzed.MapperPreAnalyzedPlugin</elasticsearch.plugin.classname>
<skip.integ.tests>true</skip.integ.tests>
<elasticsearch.version>5.5.0</elasticsearch.version>
<elasticsearch.rest.version>5.5.0</elasticsearch.rest.version>
<elasticsearch.version>5.5.3</elasticsearch.version>
<elasticsearch.rest.version>5.5.3</elasticsearch.rest.version>
<lucene.version>6.6.0</lucene.version>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.plugin.mapper.preanalyzed.MapperPreAnalyzedPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.search.SearchHit;
Expand Down Expand Up @@ -65,7 +66,7 @@ public void testAnalysis() throws Exception {
// test resources into the build folder
String mapping = IOUtils.toString(getClass().getResourceAsStream("/simpleMapping.json"), "UTF-8");
// Put the preanalyzed mapping
client().admin().indices().putMapping(putMappingRequest("test").type("document").source(mapping)).actionGet();
client().admin().indices().putMapping(putMappingRequest("test").type("document").source(mapping, XContentType.JSON)).actionGet();
assertEquals("Black", client().admin().indices().prepareAnalyze("Black").setIndex("test").setField("title")
.execute().get().getTokens().get(0).getTerm());
}
Expand All @@ -77,7 +78,7 @@ public void testSimpleIndex() throws Exception {
byte[] docBytes = IOUtils.toByteArray(getClass().getResourceAsStream("/preanalyzedDoc.json"));

// Put the preanalyzed mapping check that it is there indeed
client().admin().indices().putMapping(putMappingRequest("test").type("document").source(mapping)).actionGet();
client().admin().indices().putMapping(putMappingRequest("test").type("document").source(mapping, XContentType.JSON)).actionGet();
GetMappingsResponse actionGet =
client().admin().indices().getMappings(new GetMappingsRequest().indices("test")).get();
Map<String, Object> mappingProperties =
Expand All @@ -90,7 +91,7 @@ public void testSimpleIndex() throws Exception {
assertEquals("with_positions_offsets", titleMapping.get("term_vector"));
assertEquals("keyword", titleMapping.get("analyzer"));

index("test", "document", "1", XContentHelper.convertToJson(new BytesArray(docBytes), false, false));
index("test", "document", "1", XContentHelper.convertToJson(new BytesArray(docBytes), false, false, XContentType.JSON));
refresh();

SearchResponse searchResponse = client().prepareExecute(SearchAction.INSTANCE)
Expand Down Expand Up @@ -135,6 +136,6 @@ public void testSimpleIndex() throws Exception {
assertEquals(1, searchResponse.getHits().getTotalHits());
SearchHit searchHit = searchResponse.getHits().getHits()[0];

assertTrue(((String) searchHit.field("title").value()).startsWith("Black Beauty"));
assertTrue(((String) searchHit.getField("title").getValue()).startsWith("Black Beauty"));
}
}

0 comments on commit f7d5864

Please sign in to comment.