Multi-Value Field OR Filtering and Hybrid Server-Side Approach

Answered
Stan Beremski asked on January 29, 2026

Dear Flexmonster Team,

I am currently integrating Flexmonster with Elasticsearch for a transactional dataset.

I am facing a challenge related to filtering a field that contains multiple logical values. In our data, a single document can belong to several categories (for example: "ДМА", "ДНА", etc.). Originally, these values were stored in a delimited string, but we are now exploring better ways to support filtering.

The main requirement is to allow users to filter documents where the field contains value A OR value B OR both. While reviewing the available filtering capabilities, it appears that conditional filters do not support multiple "contains" conditions combined with OR logic on the same field.

Because our dataset is stored in Elasticsearch and can grow significantly, we are considering performing this specific filtering server-side.

I would like to ask the following:

  1. What is the recommended approach in Flexmonster for handling fields that logically contain multiple values when OR filtering is required?

  2. Is it possible to implement a custom filtering function only for this field (server-side), while retaining the rest of Flexmonster’s built-in filtering behavior from the UI?

  3. In other words, can we create a hybrid approach where:

    • this specific field is filtered by a custom function or server logic, and

    • all other fields continue to use the standard Flexmonster filtering from the UI kit?

  4. If such an approach is supported, could you please advise on the best architecture or integration pattern to achieve it?

Our goal is to preserve the native Flexmonster user experience as much as possible while extending filtering capabilities for this multi-value field.
I have attached a mock JSON file that serves as an example of our dataset.

Thank you in advance for your guidance.

Best regards,
Stanimir Beremski

Attachments:
Mocked.json

5 answers

Public
Maksym Diachenko Maksym Diachenko Flexmonster January 30, 2026

Hello, Stanimir,

Thank you for providing a detailed description of your use case.

Flexmonster does not provide a way of combining multiple "contains" filters with an OR condition. In your scenario, the recommended approach is to handle this type of filtering using a subquery, as demonstrated in the following example: https://jsfiddle.net/flexmonster/jnv7arhx
This would allow you to define a Boolean query that filters the dataset returned to Flexmonster.

If you would like to implement dynamic filtering based on subqueries, which can be accessed from UI, there are a few important architectural considerations to keep in mind:

  • A subquery filters the dataset at the data source level, meaning it cuts off a subset of data before Flexmonster processes it. This affects field member values received by Flexmonster. If you need to display the full set of member values from those concatenated strings ("ДМА", "ДНА", etc.), you should fetch them directly.
  • When the user changes the OR filter selection, you can update the Elasticsearch subquery dynamically. Since the subquery is part of the dataSource configuration, it should be updated using the updateData() API, which is designed to update data without clearing the report:
    https://www.flexmonster.com/api/updatedata/
  • All the fields can continue to use Flexmonster’s standard filtering without any changes.

 

Please let us know if the described solution would work for you.

Best regards,
Maksym

Public
Stan Beremski 2 days ago

Hi Maksym,

Thanks for your detailed reply and examples.
My case is similar but not exactly. If we take your sample data, imagine that your bikes are not in single colors but with multiple. That is, your Color property would have values like this:

"red | blue" or  "red | blue | yellow", etc.
The use case here would be  - "I want the price for all bikes that have blue color (regardless of the second or third color)" 

The user doesn't know what distinct colors there are, nor they know what color combinations exist - so making a subquery is not that simple as the user hasn't seen what they want to "subquery" yet. 

Any other suggestions?

Thanks

Public
Maksym Diachenko Maksym Diachenko Flexmonster 1 day ago

Hello, Stan,

Thank you for your reply.

We would like to further clarify that this scenario would require implementing a custom filter UI. Currently, the default Flexmonster filter UI does not allow applying multiple filters with an OR condition. In this context, the subquery approach is the only way to implement the required OR logic and get the correct result. However, it does not provide any UI controls or a way for the user to see the available values and their combinations.

The implementation of a custom filter UI is expected to be done on your side. We have provided some guidance on this in our previous reply. To recap briefly, the main points are:

  • The list of available filter options can be loaded in any way that fits your architecture - this part is outside of Flexmonster’s scope.
  • Based on the user selection, the updateData method can be used to apply the subquery and see the filtered subset of data.

In summary, Flexmonster can support this scenario from the data-loading perspective using the subquery, but the user interface for such a filter should be developed on your end.

Please let us know if everything is clear.

Best regards,
Maksym

Public
Stan Beremski 1 day ago

Thanks Maksym.

We will take it from here.

Perhaps this is something that is worth passing through your product team as I believe your clients will very much benefit from this if you add it as a native support :).

Cheers,

Stan

Public
Maksym Diachenko Maksym Diachenko Flexmonster 11 hours ago

Hi, Stan,

Thank you for your feedback.
The native support for OR filters is definitely a useful feature that could benefit our product. We will take this into consideration when planning future development.
Feel free to contact us if any further questions arise.

Best regards,
Maksym

Please sign in or register to submit your answer