Reply
Explorer
Posts: 27
Registered: ‎01-22-2014
Accepted Solution

set morphline variable from if command

Is it possble to set the value of SOLR_LOCATOR from a morphline if command? I want to assign which collection the output data should flow to based on a contains match of a substring within the _attachment_body.

Cloudera Employee
Posts: 146
Registered: ‎08-21-2013

Re: set morphline variable from if command

All variables have to statically resolve at compile time. Still, you can statically enumerate multiple solrLocators and do stuff like this:

if
{
conditions : [
{ equals { tenant : [foo] } }
]
then : [
{
loadSolr { solrLocator : { collection : collection_foo, zkHost : "127.0.0.1:2181/solr" } }
}
]
else : [
{
loadSolr { solrLocator : { collection : collection_bar, zkHost : "127.0.0.1:2181/solr" } }
}
]
}

Wolfgang.