我正在使用Nifi中的GetSolr处理器,并希望输出json。我想我需要在那里放一个json编写模式,但是我不知道这个模式应该是什么样子。我认为GetSolr没有使用wt=json (由于某种原因我无法理解),因此我有点迷路了……有人这么做过吗?谢谢
发布于 2021-06-30 12:34:51
试验和错误发现:如果您使用wt=json查询solr,您将获得嵌入到特定保护伞json中的文档列表。该模式仅使用单个文档。
因此,如果需要该模式,请使用众多在线avro模式生成器中的一个,将单个json文档的json粘贴到其中并使用该json。不是整个responseheader、response、doc-array,而是单个文档。
为了让它更清楚,这里有一个例子:
{
"id":132213,
"_version_":1689861196105121792,
"test":"asdf"
}
avro模式中的结果
{
"name": "MyClass",
"type": "record",
"namespace": "com.acme.avro",
"fields": [
{
"name": "id",
"type": "int"
},
{
"name": "_version_",
"type": "long"
},
{
"name": "test",
"type": "string"
}
]
}
https://stackoverflow.com/questions/68184094
复制相似问题