renamed ingest plugin to ingest-geoip plugin, since it only contains the geoip processor
This commit is contained in:
parent
1637fe9e0b
commit
cd2155311f
|
@ -18,8 +18,8 @@
|
|||
*/
|
||||
|
||||
esplugin {
|
||||
description 'Plugin that allows to configure pipelines to preprocess documents before indexing'
|
||||
classname 'org.elasticsearch.plugin.ingest.IngestPlugin'
|
||||
description 'Ingest processor that uses looksup geo data based on ip adresses using the Maxmind geo database'
|
||||
classname 'org.elasticsearch.ingest.geoip.IngestGeoIpPlugin'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -32,17 +32,9 @@ dependencies {
|
|||
testCompile 'org.elasticsearch:geolite2-databases:20151029'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
test {
|
||||
resources {
|
||||
srcDir "src/main/packaging/config"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task copyDefaultGeoIp2DatabaseFiles(type: Copy) {
|
||||
from { zipTree(configurations.testCompile.files.find { it.name.contains('geolite2-databases')}) }
|
||||
into "${project.buildDir}/geoip"
|
||||
into "${project.buildDir}/ingest-geoip"
|
||||
include "*.mmdb"
|
||||
}
|
||||
|
||||
|
@ -52,8 +44,8 @@ compileJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked,-serial"
|
|||
compileTestJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked"
|
||||
|
||||
bundlePlugin {
|
||||
from("${project.buildDir}/geoip") {
|
||||
into 'config/geoip'
|
||||
from("${project.buildDir}/ingest-geoip") {
|
||||
into 'config/'
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.ingest.processor;
|
||||
package org.elasticsearch.ingest.geoip;
|
||||
|
||||
import com.maxmind.geoip2.DatabaseReader;
|
||||
import com.maxmind.geoip2.exception.AddressNotFoundException;
|
||||
|
@ -222,7 +222,7 @@ public final class GeoIpProcessor implements Processor {
|
|||
return geoData;
|
||||
}
|
||||
|
||||
public static class Factory implements Processor.Factory<GeoIpProcessor>, Closeable {
|
||||
public static final class Factory implements Processor.Factory<GeoIpProcessor>, Closeable {
|
||||
|
||||
static final Set<Field> DEFAULT_FIELDS = EnumSet.of(
|
||||
Field.CONTINENT_NAME, Field.COUNTRY_ISO_CODE, Field.REGION_NAME, Field.CITY_NAME, Field.LOCATION
|
||||
|
@ -231,7 +231,7 @@ public final class GeoIpProcessor implements Processor {
|
|||
private final Map<String, DatabaseReader> databaseReaders;
|
||||
|
||||
public Factory(Path configDirectory) {
|
||||
Path geoIpConfigDirectory = configDirectory.resolve("ingest").resolve("geoip");
|
||||
Path geoIpConfigDirectory = configDirectory.resolve("ingest-geoip");
|
||||
if (Files.exists(geoIpConfigDirectory) == false && Files.isDirectory(geoIpConfigDirectory)) {
|
||||
throw new IllegalStateException("the geoip directory [" + geoIpConfigDirectory + "] containing databases doesn't exist");
|
||||
}
|
|
@ -17,19 +17,16 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.plugin.ingest;
|
||||
package org.elasticsearch.ingest.geoip;
|
||||
|
||||
import org.elasticsearch.ingest.IngestModule;
|
||||
import org.elasticsearch.ingest.processor.GeoIpProcessor;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
|
||||
public class IngestPlugin extends Plugin {
|
||||
|
||||
public static final String NAME = "ingest";
|
||||
public class IngestGeoIpPlugin extends Plugin {
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
return NAME;
|
||||
return "ingest-geoip";
|
||||
}
|
||||
|
||||
@Override
|
|
@ -17,9 +17,8 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.ingest.processor;
|
||||
package org.elasticsearch.ingest.geoip;
|
||||
|
||||
import org.elasticsearch.ingest.processor.GeoIpProcessor;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.test.StreamsUtils;
|
||||
import org.junit.Before;
|
||||
|
@ -46,7 +45,7 @@ public class GeoIpProcessorFactoryTests extends ESTestCase {
|
|||
@Before
|
||||
public void prepareConfigDirectory() throws Exception {
|
||||
this.configDir = createTempDir();
|
||||
Path geoIpConfigDir = configDir.resolve("ingest").resolve("geoip");
|
||||
Path geoIpConfigDir = configDir.resolve("ingest-geoip");
|
||||
Files.createDirectories(geoIpConfigDir);
|
||||
Files.copy(new ByteArrayInputStream(StreamsUtils.copyToBytesFromClasspath("/GeoLite2-City.mmdb")), geoIpConfigDir.resolve("GeoLite2-City.mmdb"));
|
||||
Files.copy(new ByteArrayInputStream(StreamsUtils.copyToBytesFromClasspath("/GeoLite2-Country.mmdb")), geoIpConfigDir.resolve("GeoLite2-Country.mmdb"));
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.ingest.processor;
|
||||
package org.elasticsearch.ingest.geoip;
|
||||
|
||||
import com.maxmind.geoip2.DatabaseReader;
|
||||
import org.elasticsearch.ingest.core.IngestDocument;
|
|
@ -17,11 +17,10 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.ingest;
|
||||
package org.elasticsearch.ingest.geoip;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||
import org.elasticsearch.plugin.ingest.IngestPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||
|
@ -30,14 +29,14 @@ import org.elasticsearch.test.rest.parser.RestTestParseException;
|
|||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
public class IngestRestIT extends ESRestTestCase {
|
||||
public class IngestGeoIpRestIT extends ESRestTestCase {
|
||||
|
||||
@Override
|
||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
||||
return pluginList(IngestPlugin.class);
|
||||
return pluginList(IngestGeoIpPlugin.class);
|
||||
}
|
||||
|
||||
public IngestRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||
public IngestGeoIpRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||
super(testCandidate);
|
||||
}
|
||||
|
|
@ -2,5 +2,5 @@
|
|||
- do:
|
||||
cluster.stats: {}
|
||||
|
||||
- match: { nodes.plugins.0.name: ingest }
|
||||
- match: { nodes.plugins.0.name: ingest-geoip }
|
||||
- match: { nodes.plugins.0.jvm: true }
|
|
@ -19,13 +19,8 @@
|
|||
|
||||
apply plugin: 'elasticsearch.rest-test'
|
||||
|
||||
dependencies {
|
||||
testCompile project(path: ':plugins:ingest', configuration: 'runtime')
|
||||
}
|
||||
|
||||
integTest {
|
||||
cluster {
|
||||
plugin 'ingest', project(':plugins:ingest')
|
||||
systemProperty 'es.node.ingest', 'false'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,12 +20,5 @@
|
|||
apply plugin: 'elasticsearch.rest-test'
|
||||
|
||||
dependencies {
|
||||
testCompile project(path: ':plugins:ingest', configuration: 'runtime')
|
||||
testCompile project(path: ':modules:lang-mustache', configuration: 'runtime')
|
||||
}
|
||||
|
||||
integTest {
|
||||
cluster {
|
||||
plugin 'ingest', project(':plugins:ingest')
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ List projects = [
|
|||
'plugins:discovery-ec2',
|
||||
'plugins:discovery-gce',
|
||||
'plugins:discovery-multicast',
|
||||
'plugins:ingest',
|
||||
'plugins:ingest-geoip',
|
||||
'plugins:lang-javascript',
|
||||
'plugins:lang-plan-a',
|
||||
'plugins:lang-python',
|
||||
|
|
Loading…
Reference in New Issue