I have a use case where I need to filter events from CDF based on a “string.contains” pattern. Is this possible with the current API?
Consider the following metadata field for an event in CDF.
"EventData": "t{"version":"2.0.0"},{"type":"opcae"},{"id":"1d21002a-77a2-4531-a9bf-27f28876f2e1"},{"source":"47-PA-9810B-M01"},{"time":"5/29/2024 8:56:41 AM"},{"eventType":"Simple"},{"eventCategory":3439269159},{"eventCategoryName":"Process Simple Event"},{"severity":404},{"message":"Start"},{"eventCounter":187718259},{"Class":127},{"ObjectDescription":"PH PotWtr Pump B"},{"PriorityLevel":5}]"
The value for `EventData` is a JSON string that has not been unpacked as proper metadata fields. Several of these fields are relevant for us to filter events down to the relevant subset.
It is unclear from the documentation whether the API supports the “string.contains” pattern. The only class that maybe sounds like it is relevant is the Search class. This is the documentation:
Search
The Search filter performs a full-text search on a specified property.
final classcognite.client.data_classes.filters.Search(property: Unionmstr, Tuplestr, ...], Listpstr], EnumProperty], value: Union/str, float, bool, Sequence, Mapping,str, Any], Label, PropertyReferenceValue, ParameterValue])
No detailed explanation. No examples.
Can anyone elaborate on how this use case can or cannot be solved with the API? Currently we fetch maybe 100k events and filter down to maybe 500 that are relevant. In other words, we really want to be able to filter on the EventData string-
Thanks for any advice!