0

我正在尝试从 HBase 中的基于行的结构将逗号分隔的字符串作为多值字段插入到我的 morphline 配置中。

任何人都可以建议任何更好的方法或经验我是新手。

有什么办法我可以做到这一点。

HBase-Indexer 映射器:

<?xml version="1.0"?>
<indexer table="Document_Test"
    mapper="com.ngdata.hbaseindexer.morphline.MorphlineResultToSolrMapper"
    unique-key-field="documentId" mapping="row">

    <param name="morphlineFile" value="/path/to/morphline.conf" />

</indexer>

吗啉配置:

{
   extractHBaseCells {
             mappings : [
                           {
                              inputColumn : "CF:DocumentId"
                              outputField : documentId
                              type : long
                              source : value
                           }
                           {
                              inputColumn : "CF:Persons"
                              outputField : persons
                              type : string
                              source : value
                           }
                        ]
                    }

      // Some command here which can be used, I tried with **java**, But didn't worked and make it a single string

}

它只是像这样制作一个字符串:

 {
    "persons": [
      "[Panos Kammenos, King Salman, Nabil Sadek, Ehab Azmy, Hesham Abdelhamid]"
    ],
    "documentId": 38900223,
    "_version_": 1535233203724353500
  }

更新

试过这个,它适用于基于行的映射或高结构。

     {
    extractHBaseCells {
        mappings : [
            {
                inputColumn : "CF:DocumentId"
                outputField : documentId
                type : long
                source : value
            }
            {
                inputColumn : "CF:Persons"
                outputField : persons
                type : string
                source : value
            }
        ]
    }
}
{
    split{
        inputField : persons
        outputField : persons_multi
        separator : ","
        isRegex : false
    }
}
4

1 回答 1

1

您可以按如下方式使用拆分命令:

{
    extractHBaseCells {
        mappings : [
            {
                inputColumn : "CF:DocumentId"
                outputField : documentId
                type : long
                source : value
            }
            {
                inputColumn : "CF:Persons"
                outputField : persons
                type : string
                source : value
            }
        ]
    }
}
{
    split{
        inputField : persons
        outputField : persons_multi
        separator : ","
        isRegex : false
    }
}

如果您遇到任何问题,请告诉我。

于 2016-05-25T21:28:44.460 回答