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