Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Show file_name in solr indexed data

Show file_name in solr indexed data

New Contributor

Hi,

 

I want to show file_name along with serach result. I am using flume and morphlines.conf as sink. what is field name which stores file_name

1 REPLY 1

Re: Show file_name in solr indexed data

Super Collaborator

The fields in the solr documents are specified in the schema.xml and would be populated from your morphlines.conf file. What is the source data that the field is coming from? If it is something like the spooldir source, then you would just need to add a field in solr that matches the value in
basenameHeaderKey from the spooldir source [1].

 

For example if your source is:

a1.sources.src-1.type = spooldir
a1.sources.src-1.channels = ch-1
a1.sources.src-1.spoolDir = /var/log/apache/flumeSpool
a1.sources.src-1.basenameHeader = true
a1.sources.src-1.basenameHeaderKey = filename

Then in your solr schema.xml, you need to have a 'filename' field:

 

   <field name="filename" type="string" indexed="true" stored="true" />

And then morphlines will pass the 'filename' header as a solr document field to the solr locator.  In this example, you'd have a solr document field filename with a value of 'flumeSpool'.

 

[1] http://flume.apache.org/FlumeUserGuide.html#spooling-directory-source