Class OpenSearch1xIndexWriter
- java.lang.Object
-
- org.apache.nutch.indexwriter.opensearch1x.OpenSearch1xIndexWriter
-
- All Implemented Interfaces:
Configurable,IndexWriter,Pluggable
public class OpenSearch1xIndexWriter extends Object implements IndexWriter
Sends NutchDocuments to a configured OpenSearch index.
-
-
Field Summary
-
Fields inherited from interface org.apache.nutch.indexer.IndexWriter
X_POINT_ID
-
-
Constructor Summary
Constructors Constructor Description OpenSearch1xIndexWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.opensearch.action.bulk.BulkProcessor.ListenerbulkProcessorListener()Generates a default BulkProcessor.Listenervoidclose()voidcommit()voiddelete(String key)Map<String,Map.Entry<String,Object>>describe()ReturnsMapwith the specific parameters the IndexWriter instance can take.ConfigurationgetConf()protected org.opensearch.client.RestHighLevelClientmakeClient(IndexWriterParams parameters)Generates a RestHighLevelClient with the hosts givenvoidopen(Configuration conf, String name)voidopen(IndexWriterParams parameters)Initializes the internal variables from a given index writer configuration.voidsetConf(Configuration conf)voidupdate(NutchDocument doc)voidwrite(NutchDocument doc)
-
-
-
Method Detail
-
open
public void open(Configuration conf, String name) throws IOException
- Specified by:
openin interfaceIndexWriter- Parameters:
conf- Nutch configurationname- target name of theIndexWriterto be opened- Throws:
IOException- Some exception thrown by some writer.
-
open
public void open(IndexWriterParams parameters) throws IOException
Initializes the internal variables from a given index writer configuration.- Specified by:
openin interfaceIndexWriter- Parameters:
parameters- Params from the index writer configuration.- Throws:
IOException- Some exception thrown by writer.
-
makeClient
protected org.opensearch.client.RestHighLevelClient makeClient(IndexWriterParams parameters) throws IOException
Generates a RestHighLevelClient with the hosts given- Parameters:
parameters- implementation specificIndexWriterParams- Returns:
- an initialized
RestHighLevelClient - Throws:
IOException- if there is an error reading theIndexWriterParams
-
bulkProcessorListener
protected org.opensearch.action.bulk.BulkProcessor.Listener bulkProcessorListener()
Generates a default BulkProcessor.Listener- Returns:
BulkProcessor.Listener
-
write
public void write(NutchDocument doc) throws IOException
- Specified by:
writein interfaceIndexWriter- Throws:
IOException
-
delete
public void delete(String key) throws IOException
- Specified by:
deletein interfaceIndexWriter- Throws:
IOException
-
update
public void update(NutchDocument doc) throws IOException
- Specified by:
updatein interfaceIndexWriter- Throws:
IOException
-
commit
public void commit() throws IOException- Specified by:
commitin interfaceIndexWriter- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceIndexWriter- Throws:
IOException
-
describe
public Map<String,Map.Entry<String,Object>> describe()
ReturnsMapwith the specific parameters the IndexWriter instance can take.- Specified by:
describein interfaceIndexWriter- Returns:
- The values of each row. It must have the form <KEY,<DESCRIPTION,VALUE>>.
-
setConf
public void setConf(Configuration conf)
- Specified by:
setConfin interfaceConfigurable
-
getConf
public Configuration getConf()
- Specified by:
getConfin interfaceConfigurable
-
-