New Contributor
Posts: 1
Registered: ‎03-31-2016

Show file_name in solr indexed data



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

Cloudera Employee
Posts: 273
Registered: ‎01-09-2014

Re: Show file_name in solr indexed data

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'.