Event and Measurements API how to search most effective for non base object parameters

What product/components do you use and which version/fix level are you on?

Java Cumulocity SDK 1015.120.0

EventApi

Is your question related to the free trial, or to a production (customer) instance?

Its at an Enterprise Tenant

What are you trying to achieve? Please describe it in detail.

  1. We would like to have a possibility to filter in the query for more than one custom property.

  2. We would like to have a possibility to search inside of the property (if they are string) for text fragments.

How could the code look like

For 1.
var eventFilter = new EventFilter();
eventFilter.byType(type).bySource(lineId).byFragmentType(“recipeValue”).byFragmentType(“productName”);
var firstSearchEvent = eventApi.getEventsByFilter(eventFilter).get(WITH_TOTAL_PAGES);

(of course we would need the framentValue of the REST API as well but we could not find it in the Java API
For 2.

var eventFilter = new EventFilter();
eventFilter.byType(type).bySource(lineId).byFragmentType("name").byFragmentValue(".*test.*");
var firstSearchEvent = eventApi.getEventsByFilter(eventFilter).get(WITH_TOTAL_PAGES);

result could look like (in json):

                                    {
                                                  …
                                                   name: 'Test order'
                                                  …
                                     },
                                     {
                                                  …
                                                   name: 'Order to test output'
                                                  …
                                     }

We would like to filter for a text fragment if the fragment we are searching is a String.

Currently the two queries are not possible.
It is only possible to query for one custom fragmentType/fragmentValue. The fragmentValue does not support wildcards.

Regards Christof

1 Like

A bad workaround could be to combine two (or more) fragments to one combined fragmentName e.g. using Apama Analytics Builder a microservice or within the agent and filter for this combined fragment name. Also you can reduce the list by filter irrelevant events after fetching them of the API of course but this is also not a very nice solution. Both have their drawbacks.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.