Skip to content

Commit

Permalink
Compatible with Elasticsearch 6.0.1.
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 e7a649d commit 92517d5
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 33 deletions.
52 changes: 28 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,34 @@ 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)
| es-5.4.1 | 5.4.1 | [5.4.1](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.4.1)
| es-5.4.0 | 5.4.0 | [5.4.0](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.4.0)
| es-5.3.3 | 5.3.3 | [5.3.3-mvn](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.3.3-mvn)
| es-5.3.2 | 5.3.2 | [5.3.2](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.3.2)
| es-5.3.1 | 5.3.1 | [5.3.1](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.3.1)
| es-5.3.0 | 5.3.0 | [5.3.0](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.3.0)
| es-5.2.2 | 5.2.2 | [5.2.2](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.2.2)
| es-5.0.2 | 5.0.2 | [5.0.2](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.0.2)
| es-5.0.0 | 5.0.0 | [5.0.0](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.0.0)
| es-2.4.6 | 2.4.6 | [2.4.6](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-2.4.6)
| es-2.4.0 | 2.4.0 | [2.4.0](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-2.4.0)
| es-2.3.5 | 2.3.5 | [2.3.5](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-2.3.5)
| es-2.3.0 | 2.3.0 | [2.3.0](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-2.3.0)
| es-2.2.2 | 2.2.2 | [2.2.2](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-2.2.2)
| es-2.2.0 | 2.2.0 | [2.2.0](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-2.2.0)
| es-2.1.2 | 2.1.2 | [2.1.2](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-2.1.2)
| es-2.1.1 | 2.1.1 | [2.1.1](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-2.1.1)
| es-1.7 | 0.1.0 | [0.1.0](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-1.7)
| es-1.5 | 0.0.5 | [0.0.5](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-1.5)
| es-1.4 | 0.0.4 | [0.0.4](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-1.4)
| es-6.0.1 | 6.0.1 | [6.0.1-mvn](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-6.0.1-mvn)
| es-6.0.1 | 6.0.1 | [6.0.1](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-6.0.1)
| es-5.6.14 | 5.6.14 | [5.6.14-mvn](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.6.14-mvn)
| es-5.6.0 | 5.6.0 | [5.6.0-mvn](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.6.0-mvn)
| 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)
| es-5.4.1 | 5.4.1 | [5.4.1](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.4.1)
| es-5.4.0 | 5.4.0 | [5.4.0](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.4.0)
| es-5.3.3 | 5.3.3 | [5.3.3-mvn](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.3.3-mvn)
| es-5.3.2 | 5.3.2 | [5.3.2](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.3.2)
| es-5.3.1 | 5.3.1 | [5.3.1](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.3.1)
| es-5.3.0 | 5.3.0 | [5.3.0](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.3.0)
| es-5.2.2 | 5.2.2 | [5.2.2](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.2.2)
| es-5.0.2 | 5.0.2 | [5.0.2](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.0.2)
| es-5.0.0 | 5.0.0 | [5.0.0](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-5.0.0)
| es-2.4.6 | 2.4.6 | [2.4.6](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-2.4.6)
| es-2.4.0 | 2.4.0 | [2.4.0](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-2.4.0)
| es-2.3.5 | 2.3.5 | [2.3.5](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-2.3.5)
| es-2.3.0 | 2.3.0 | [2.3.0](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-2.3.0)
| es-2.2.2 | 2.2.2 | [2.2.2](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-2.2.2)
| es-2.2.0 | 2.2.0 | [2.2.0](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-2.2.0)
| es-2.1.2 | 2.1.2 | [2.1.2](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-2.1.2)
| es-2.1.1 | 2.1.1 | [2.1.1](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-2.1.1)
| es-1.7 | 0.1.0 | [0.1.0](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-1.7)
| es-1.5 | 0.0.5 | [0.0.5](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-1.5)
| es-1.4 | 0.0.4 | [0.0.4](https://github.com/JULIELab/elasticsearch-mapper-preanalyzed/tree/es-1.4)

This can be useful if a stand-alone text analysis engine is available, for instance a UIMA or GATE pipeline, and you would like to transfer the analysis results one to one into the ElasticSearch index.
For example, a named entity recognizer in the natural language processing (NLP) pipeline might classify ranges of text as being the mention of a company. This kind of logic is typically too complicated for the default use of a Lucene or ElasticSearch analyzer on the one hand, and the recognition engine might not be easily integratable into an analyzer. However, it might be desired to store the named entity mentions - e.g. in the form of a special term 'COMP' - in the index just like one would to with synonyms: With the same offset as the original text and with position increment 0. This would cause highlighting to work as expected: When the term 'COMP' is searched for, all the recognized text ranges would be highlighted by the ElasticSearch built-in highlighting features, just like with synonyms.
Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<groupId>de.julielab</groupId>
<artifactId>elasticsearch-mapper-preanalyzed</artifactId>
<name>Plugin: Mapper: Preanalyzed</name>
<version>5.6.14</version>
<version>6.0.1</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.6.14</elasticsearch.version>
<elasticsearch.rest.version>5.6.14</elasticsearch.rest.version>
<lucene.version>6.6.0</lucene.version>
<elasticsearch.version>6.0.1</elasticsearch.version>
<elasticsearch.rest.version>6.0.1</elasticsearch.rest.version>
<lucene.version>7.0.1</lucene.version>
</properties>

<build>
Expand Down Expand Up @@ -120,13 +120,13 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.9.0</version>
<version>2.9.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.9.0</version>
<version>2.9.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.elasticsearch.index.mapper.Mapper;
import org.elasticsearch.index.mapper.MetadataFieldMapper;
import org.elasticsearch.index.mapper.ParseContext.Document;
import org.elasticsearch.index.mapper.SourceToParse;
import org.elasticsearch.index.mapper.TextFieldMapper;
import org.elasticsearch.index.mapper.preanalyzed.PreAnalyzedMapper.PreAnalyzedTokenStream;
import org.elasticsearch.indices.mapper.MapperRegistry;
Expand Down Expand Up @@ -78,7 +79,7 @@ public void testSimple() throws Exception {
String mapping = IOUtils.toString(getClass().getResourceAsStream("/simpleMapping.json"), "UTF-8");
byte[] docBytes = IOUtils.toByteArray(getClass().getResourceAsStream("/preanalyzedDoc.json"));
DocumentMapper docMapper = parser.parse(null, new CompressedXContent(mapping));
Document doc = docMapper.parse("test", "document", "1", new BytesArray(docBytes)).rootDoc();
Document doc = docMapper.parse(SourceToParse.source("test", "document", "1", new BytesArray(docBytes), XContentType.JSON)).rootDoc();

// Check field: "author"
IndexableField field = doc.getField("author");
Expand Down Expand Up @@ -121,7 +122,7 @@ public void testCopyField() throws Exception {
String mapping = IOUtils.toString(getClass().getResourceAsStream("/copyToMapping.json"), "UTF-8");
byte[] docBytes = IOUtils.toByteArray(getClass().getResourceAsStream("/preanalyzedDoc.json"));
DocumentMapper docMapper = parser.parse(null, new CompressedXContent(mapping));
Document doc = docMapper.parse("test", "document", "1", new BytesArray(docBytes)).rootDoc();
Document doc = docMapper.parse(SourceToParse.source("test", "document", "1", new BytesArray(docBytes), XContentType.JSON)).rootDoc();

// Check field: "author"
IndexableField field = doc.getField("author");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,6 @@ public void testSimpleIndex() throws Exception {
assertEquals(1, searchResponse.getHits().getTotalHits());
SearchHit searchHit = searchResponse.getHits().getHits()[0];

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

0 comments on commit 92517d5

Please sign in to comment.