Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GOBBLIN-17] Add Elasticsearch writer (rest + transport)
Closes #2419 from shirshanka/elastic
- Loading branch information
1 parent
ef438c8
commit f1bc746
Showing
46 changed files
with
3,005 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
gobblin-core-base/src/main/java/org/apache/gobblin/writer/LargeMessagePolicy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.gobblin.writer; | ||
|
||
/** | ||
* Describes how single messages that are larger than a batch message limit should be treated | ||
*/ | ||
public enum LargeMessagePolicy { | ||
DROP, // drop (and log) messages that exceed the threshold | ||
ATTEMPT, // attempt to deliver messages that exceed the threshold | ||
FAIL // throw an error when this happens | ||
} |
20 changes: 20 additions & 0 deletions
20
gobblin-core-base/src/main/java/org/apache/gobblin/writer/RecordTooLargeException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.gobblin.writer; | ||
|
||
public class RecordTooLargeException extends Exception { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# A sample pull file that copies an input Kafka topic and produces to an output Kafka topic | ||
# with sampling | ||
job { | ||
name=PullFromWikipediaToElasticSearch | ||
group=Wikipedia | ||
description=Pull from Wikipedia and write to ElasticSearch | ||
} | ||
|
||
task.maxretries=0 | ||
|
||
source { | ||
class=org.apache.gobblin.example.wikipedia.WikipediaSource | ||
page.titles="Wikipedia:Sandbox" | ||
revisions.cnt=5 | ||
} | ||
|
||
wikipedia { | ||
api.rooturl="https://en.wikipedia.org/w/api.php" | ||
avro.schema="{\"namespace\": \"example.wikipedia.avro\",\"type\": \"record\",\"name\": \"WikipediaArticle\",\"fields\": [{\"name\": \"revid\", \"type\": [\"double\", \"null\"]},{\"name\": \"pageid\", \"type\": [\"double\", \"null\"]},{\"name\": \"title\", \"type\": [\"string\", \"null\"]},{\"name\": \"user\", \"type\": [\"string\", \"null\"]},{\"name\": \"anon\", \"type\": [\"string\", \"null\"]},{\"name\": \"userid\", \"type\": [\"double\", \"null\"]},{\"name\": \"timestamp\", \"type\": [\"string\", \"null\"]},{\"name\": \"size\", \"type\": [\"double\", \"null\"]},{\"name\": \"contentformat\", \"type\": [\"string\", \"null\"]},{\"name\": \"contentmodel\", \"type\": [\"string\", \"null\"]},{\"name\": \"content\", \"type\": [\"string\", \"null\"]}]}" | ||
} | ||
converter.classes=org.apache.gobblin.example.wikipedia.WikipediaConverter | ||
extract.namespace=org.apache.gobblin.example.wikipedia | ||
|
||
writer { | ||
builder.class=org.apache.gobblin.elasticsearch.writer.ElasticsearchDataWriterBuilder | ||
elasticsearch { | ||
client.type=REST | ||
index.name=wikipedia-test | ||
index.type=docs | ||
#hosts=hostname | ||
#ssl { | ||
# enabled=true | ||
# keystoreType=pkcs12 | ||
# keystorePassword=change_me | ||
# keystoreLocation=/path/to/.p12 file | ||
# truststoreType=jks | ||
# truststoreLocation=/path/to/cacerts | ||
# truststorePassword=changeme | ||
#} | ||
typeMapperClass=org.apache.gobblin.elasticsearch.typemapping.AvroGenericRecordTypeMapper | ||
useIdFromData=false # change to true if you want to use a field from the record as the id field | ||
#idFieldName=id # change to the field of the record that you want to use as the id of the document | ||
} | ||
} | ||
|
||
data.publisher.type=org.apache.gobblin.publisher.NoopPublisher | ||
|
Oops, something went wrong.