我是弹性搜索的新手。我有一个API,可将我想要的XML文件提取到弹性搜索中。但是我必须先将一些ID匹配在一起。
我在这里有一个数据示例:
<specification>
<resources>
<events>
<event id="Activity1">
<custom>
<roles>
<role>Doctor</role>
<eventScope>private</eventScope>
<eventDescription> Descriptions text with some
in HTML format and lineshift
</eventDescription>
</custom>
</event>
<event id="Activity2">
<custom>
<roles>
<role>Nurse</role>
<eventScope>private</eventScope>
<eventDescription> Other Descriptions text with some
in HTML format and lineshift
</eventDescription>
</custom>
</event>
<labels>
<label id="Doctor does this" />
<label id="Nurse does that" />
</labels>
<labelMappings>
<labelMapping eventId="Activity1" labelId="Doctor does this"/>
<labelMapping eventId="Activity2" labelId="Nurse does that"/>
</labelMappings>
<custom>
<keywords></keywords>
<roles>
<role description="Nurse at the hospital">Nurse</role>
<role description="Doctor at the hospital">Doctor</role>
</roles>
</custom>
</resources>
</specification>
我希望我的数据看起来像这样
"Eventheadline": "Doctor does this",
"role: "Doctor",
"roleDescription": "Doctor at the hospital",
"eventScope": "private",
"eventDescription": "Descriptions text with some
in html format and line shift",
"Eventheadline": "Nurse does that",
"role": "Nurse",
"roleDescription": "Nurse at the hospital",
"eventScope": "private",
"eventDescription": "Other Descriptions text with some
in html format and line shift",
我已经找到了将一个xml传递到几个日志条目中的指南,但是我需要匹配事件ID以获取Eventheadline以获得完整的elastic-search-entry,因此该指南不够充分。 https://serverfault.com/questions/615196/logstash-parsing-xml-document-containing-multiple-log-entries