我在AWS ec2 ubuntu实例上有Apache Nuch 1.7和Elasticsearch 1.4.4。我使用Nutch抓取数据,但如何使用Elasticsearch索引数据?没有与此相关的官方文档。
最佳答案
在您的nutch-site.xml中添加以下属性:
<property>
<name>plugin.includes</name>
<value>protocol-http|urlfilter-regex|parse-(html|tika)|index-(basic|anchor)|indexer-elastic|scoring-opic|urlnormalizer-(pass|regex|basic)</value>
</property>
以上将使elasticsearch成为索引器。
以下是指定elasticsearch的主机
<property>
<name>elastic.host</name>
<value>localhost</value>
</property>
您可以设置的其他可选属性是elastic.port,elastic.cluster等。
现在,您指定已经抓取了数据,现在想要对其进行索引,因此可以使用
./bin/nutch index <crawldb> -dir <segment_dir>
这将索引段中所有已爬网的数据。您可以检查文档的elasticsearch索引。
关于elasticsearch - 索引使用Elasticsearch从Apache Nut抓取的数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29363782/