简体   繁体   English

从 a 中提取 elasticsearch 日期<start-date> /<duration> XBRL-JSON 格式

[英]extract elasticsearch date from a <start-date>/<duration> XBRL-JSON format

I am storing XBRL JSON using elasticsearch.我正在使用 elasticsearch 存储 XBRL JSON。

This xBRL-JSON OIM spec describes the oim:period property: 这个 xBRL-JSON OIM 规范描述了oim:period属性:

Otherwise, an ISO 8601 time interval representing the {interval} property, expressed in one of the following forms:否则,表示 {interval} 属性的 ISO 8601 时间间隔,以下列形式之一表示:

<start>/<end> <开始>/<结束>

<start>/<duration> <开始>/<持续时间>

<duration>/<end> <持续时间>/<结束>

Where <start> and <end> are valid according to the xsd:dateTime datatype, and <duration> is valid according to xsd:duration.其中 <start> 和 <end> 根据 xsd:dateTime 数据类型有效,<duration> 根据 xsd:duration 有效。

Examples from arelle's plugin look like this:来自areelle 插件的示例如下所示:

  • 2016-01-01T00:00:00/PT0S 2016-01-01T00:00:00/PT0S
  • 2015-01-01T00:00:00/P1Y 2015-01-01T00:00:00/P1Y

I notice that arelle's plugin exclusively produces this format:我注意到 arelle 的插件专门生成这种格式:

  • <start>/<duration> <开始>/<持续时间>

My question我的问题

Is there a way to save at least the <start> part as a date type in elasticsearch?有没有办法至少将<start>部分保存为 elasticsearch 中的日期类型?

Ideas I had:我的想法:

elastichsearch only (my preference)仅弹性搜索(我的偏好)

  • Use a custom date format which anticipates the /<duration> part, but ignores it使用预期/<duration>部分但忽略它的自定义日期格式
    • I haven't checked Joda yet;我还没有检查 Joda; will it ignore characters in the date format if they aren't part of the special character?如果日期格式中的字符不是特殊字符的一部分,它会忽略它们吗? Like the "/" delimiter or the "P" which precedes any duration value (like PT0S and P1Y above)?像“/”分隔符或任何持续时间值之前的“P”(如上面的PT0SP1Y )?
    • EDIT So the single-quote character escapes literals;编辑所以单引号字符转义文字; this works yyyy'/P' will accept a value '2015/P'.这有效yyyy'/P'将接受值 '2015/P'。 However, the rest of the duration could be more dynamic但是,剩余的持续时间可能会更加动态
    • Re: dynamic;回复:动态; will Joda accept regex or wildcard character like "\\d" or "+" qualifier so I can ignore all the possible variations following the P ? Joda 是否会接受正则表达式或通配符,如 "\\d" 或 "+" 限定符,以便我可以忽略P之后的所有可能的变化?
  • Use a character filter to strip out the /<duration> part before saving only <start> as datetime.在仅将<start>保存为日期/<duration>之前,使用字符过滤器去除/<duration>部分。 But I don't know if character filters happen before saving as type: date.但我不知道保存为 type: date之前是否发生了字符过滤器。 If they don't, the '/`part isn't stripped, and I wouldn't be passing valid date strings.如果他们不这样做, '/` 部分不会被剥离,我也不会传递有效的日期字符串。
  • Don't use date type: Use a pattern tokenizer to split on / , and at least the two parts will be saved as separate tokens.不要使用日期类型:使用模式标记器/上拆分,至少这两个部分将保存为单独的标记。 Can't use date math, though.但是不能使用日期数学。
  • Use a transformation ;使用转换 although it seems like this is deprecated.尽管这似乎已被弃用。 I read about using copy_to instead, but that seems to combine terms, and I want to break this term apart我读了有关使用copy_to代替,但似乎方面结合起来,我想除了打破这个词
  • Some sort of plugin ?某种插件 Maybe a plugin which will fully support this "interval" datatype described by the OIM spec... maybe a plugin which will store its separate parts...?也许一个插件将完全支持 OIM 规范描述的这种“间隔”数据类型......也许一个插件将存储其单独的部分......?

change my application (I prefer to use elasticsearch-only techniques if possible)更改我的应用程序(如果可能,我更喜欢使用仅使用 elasticsearch 的技术)

  • I could edit this plugin or produce my own plugin which uses exclusively <start> and <end> parts, and saves both into separate fields;我可以编辑这个插件或制作我自己的插件,它只使用<start><end>部分,并将它们保存到单独的字段中;
    • But this breaks the OIM spec, which says they should be combined in a single field但是,这断OIM规范,它说他们应该在场组合
    • Moreover it can be awkward to express an "instant" fact (with no duration; the PT0S examples above);此外,表达“即时”事实可能很尴尬(没有持续时间;上面的PT0S示例); I guess I just use the same value for end property as start property... Not more awkward than a 0-length duration ( PT0S ) I guess.我想我只是对end属性使用与start属性相同的值......我猜不会比 0 长度持续时间( PT0S )更尴尬。

Not a direct answer, but it's worth noting that the latest internal drafts of the xBRL-JSON specification have moved away from the the single-field representation.不是直接的答案,但值得注意的是,xBRL-JSON 规范的最新内部草案已经脱离了单字段表示。 Although the "/" separated notation is an ISO standard, tool support for it appears to be extremely poor, and so the working group has chosen to switch to separate fields for start and end dates.虽然“/”分隔符号是 ISO 标准,但对它的工具支持似乎非常差,因此工作组选择切换到单独的开始日期和结束日期字段。 I would expect Arelle support to follow suit in due course.我希望 Arelle 支持在适当的时候效仿。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM