将存储在hbase中的json对象映射到solr

时间:2019-06-11 13:58:51

标签: solr hbase morphline

我有一个hbase表,其中包含以下数据

ROW                                                    COLUMN+CELL
 test2                                                 column=data:json, timestamp=1560259758891, value={"name" : "john", "age" : "25", "gender" : "M"}

我已经安装了lily hbase索引器,我正在将数据索引到solr中,将数据映射到solr中的数据域,但是我想知道是否有可能将json中的各个字段映射到solr中的字段。例如

Json被解析,并且名称字段映射到solr中的名称字段。

我有吗啉示例,但它不起作用,我不确定是否可以实现我想要的

SOLR_LOCATOR : {   # Name of solr collection   collection : collection
     # ZooKeeper ensemble   zkHost : "$ZK_HOST"  }


morphlines : [ {
    id : morphline1
    importCommands : ["org.kitesdk.**", "org.apache.solr.**", "com.ngdata.**"]
    commands : [
      {
         extractHBaseCells {
          mappings : [
            {
             inputColumn : "data:json"
              outputField : "_attachment_body"
              type : "byte[]"
              source : value
            }
         ]
        }
      }

      #for avro use with type : "byte[]" in extractHBaseCells mapping above
      { readJson {} }
      {
        extractJsonPaths {
         flatten: true
         paths: {
            name: /name
            age: /age
            gender: /gender
        }
      }
          {         sanitizeUnknownSolrFields {             solrLocator : ${SOLR_LOCATOR}       }     }

      { logTrace { format : "output record: {}", args : ["@{}"] } }
    ]  } ]

0 个答案:

没有答案