Having difficulty indexing an attachment type in elasticsearch via the *
Tire* gem. Not able to set attachment type correctly. I'm sure it's a
syntax error or some other misunderstanding on my part.
def to_indexed_json
to_json(:methods => [:attachment])
end
def attachment
if filename.present?
path_to_pdf =
"/Volumes/Disk41402/test_proj/sample_pdfs/#{filename}.pdf"
Base64.encode64(open(path_to_pdf) { |pdf| pdf.read })
end
end
end
Log shows a No handler for type [attachment] declared on field [attachment] error
when I try to re-index with $ rake environment tire:import CLASS=Article
FORCE=true
Log output:
[2012-06-28 22:33:18,269][DEBUG][indices ] [Solarr]
deleting Index [articles]
[2012-06-28 22:33:18,270][DEBUG][index.cache.filter.weighted] [Solarr]
[articles] full cache clear, reason [close]
[2012-06-28 22:33:18,270][DEBUG][index.cache.field.data.resident] [Solarr]
[articles] full cache clear, reason [close]
[2012-06-28 22:33:18,271][WARN ][cluster.metadata ] [Solarr]
[articles] failed to create
org.elasticsearch.index.mapper.MapperParsingException: mapping [article]
at
org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$1.execute(MetaDataCreateIndexService.java:263)
at
org.elasticsearch.cluster.service.InternalClusterService$2.run(InternalClusterService.java:211)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: org.elasticsearch.index.mapper.MapperParsingException: No
handler for type [attachment] declared on field [attachment]
at
org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseProperties(ObjectMapper.java:259)
at
org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parse(ObjectMapper.java:217)
at
org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:161)
at
org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:271)
at org.elasticsearch.index.mapper.MapperService.add(MapperService.java:174)
at
org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$1.execute(MetaDataCreateIndexService.java:260)
Having difficulty indexing an attachment type in elasticsearch via the Tire gem. Not able to set attachment type correctly. I'm sure it's a syntax error or some other misunderstanding on my part.
def to_indexed_json
to_json(:methods => [:attachment])
end
def attachment
if filename.present?
path_to_pdf = "/Volumes/Disk41402/test_proj/sample_pdfs/#{filename}.pdf"
Base64.encode64(open(path_to_pdf) { |pdf| pdf.read })
end
end
end
Log shows a No handler for type [attachment] declared on field [attachment] error when I try to re-index with $ rake environment tire:import CLASS=Article FORCE=true
Log output:
[2012-06-28 22:33:18,269][DEBUG][indices ] [Solarr] deleting Index [articles]
[2012-06-28 22:33:18,270][DEBUG][index.cache.filter.weighted] [Solarr] [articles] full cache clear, reason [close]
[2012-06-28 22:33:18,270][DEBUG][index.cache.field.data.resident] [Solarr] [articles] full cache clear, reason [close]
[2012-06-28 22:33:18,271][WARN ][cluster.metadata ] [Solarr] [articles] failed to create
org.elasticsearch.index.mapper.MapperParsingException: mapping [article]
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$1.execute(MetaDataCreateIndexService.java:263)
at org.elasticsearch.cluster.service.InternalClusterService$2.run(InternalClusterService.java:211)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: org.elasticsearch.index.mapper.MapperParsingException: No handler for type [attachment] declared on field [attachment]
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseProperties(ObjectMapper.java:259)
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parse(ObjectMapper.java:217)
at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:161)
at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:271)
at org.elasticsearch.index.mapper.MapperService.add(MapperService.java:174)
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$1.execute(MetaDataCreateIndexService.java:260)
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.