[Bug] Advanced Search: Number custom property "between" filter returns all entities that have the property set, ignoring the range bounds; sometimes search API is not called
When using Advanced Search with a number type custom property and the between operator, two issues are observed:
The filter ignores the specified range and returns all entities that have the custom property set — regardless of whether the value falls within the range. For example, filtering between 1 and 5 returns an entity with value 100. Sometimes when the between operator is selected and values are entered, the search API is not triggered at all — the results remain stale from the previous query.
https://github.com/user-attachments/assets/225bae10-a742-4985-988c-1fd61e191947
Hi @chirag-madlani @Rohit0301 I would like to work on this. Could you plz assign this issue to me?
Hi, @chirag-madlani I’m interested in working on this issue. I’ll try to reproduce it locally and investigate both the incorrect between range behavior and the missing search API trigger.
Hi @chirag-madlani @ulixius9 Please assign this issue to me, I would like to fix this.
https://github.com/user-attachments/assets/44e02d3b-23f8-4498-8af3-2307b12de297
I have reproduced it on my local, and now i am ready to fix it. Please assign this to me.
Hi @chirag-madlani @Rohit0301 — I've analyzed both issues:
-
The "between" filter is likely building the range query incorrectly — missing gte/lte bounds in the Elasticsearch query construction.
-
The missing API trigger is likely a useEffect dependency issue on the second input field not firing the search call.
I'm digging into the search filter logic now to pinpoint the exact files. Can you assign this to me?
Hi, I’d like to work on this issue.
From the description, it seems there are two problems:
- The "between" filter is not correctly applying range conditions, so it returns all entities instead of filtering within bounds.
- The search API not triggering might be related to how the input state is handled when updating the second value.
I’ll try to reproduce this locally and investigate both the query construction and UI behavior.
Could you please assign it to me?
Hi, I can take ownership of this issue and fix the advanced search between filter for number custom properties. I will trace the query-builder logic and the React UI state that fails to dispatch the API call when the second boundary is inputted. Please assign me for the WeMakeDevs Hackathon!
Hi @Rohit0301 I would like to work on this one for the hackathon, can you please assign it to me?
Hi @Rohit0301, I would like to work on this one for the hackathon. Can you please assign it to me?
According to my analysis:
1. The Database Ignores "Between" Filters
Problem: The code that translates your filters to the database doesn't know what "between" or "not between" means. Since it doesn't understand the command, it just ignores the filter and returns all the results.
Solution: Add a specific rule teaching the code how to handle "between" (looking for a range from a start value to an end value) and "not between" (doing the exact opposite).
2. The Search Doesn't Trigger on the Second Number
Problem: In the automated test, typing the second number into the "between" boxes doesn't actually tell the app to update. The system only notices when the first box changes.
Solution: Update the test to make sure the app registers both inputs. You can do this by having the test press "Enter" or "Tab" after filling out each individual box before it tries to run the search.
@chirag-madlani please assign this issue to me
hey @Rohit0301 @chirag-madlani i would love to work on it could you please assign it to me ? thanks
Hi @Rohit0301 @chirag-madlani 👋
Update: PR submitted → (https://github.com/open-metadata/OpenMetadata/pull/27525)
What I found after deep diagnosis:
The root cause is purely in QueryBuilderElasticsearchFormatUtils.js — the buildEsRule function passes value[0] instead of the full value array to buildExtensionQuery for extension fields. For the between operator, RAQB stores inputs as [from, to], so the upper bound is silently dropped before the Elasticsearch range query is built.
The "search API not triggered" issue is a downstream consequence of the same bug — the broken query was structurally identical on every Apply click, so the isEqual guard short-circuited setQueryFilter. Fixing Vector 1 resolves Vector 2 automatically. No changes to AdvanceSearchProvider were needed.
Fix: 5-line change — introduced an isBetweenOp check that passes the full [from, to] array for between/not_between and value[0] for all other operators (no regression).
Verified with unit tests
Hi @Rohit0301 @chirag-madlani,
I'd like to work on this issue. I've done a deep technical analysis and reproduced the bug locally. Here's my understanding and proposed fix:
Root Cause Analysis:
The bug is in openmetadata-ui/src/main/resources/ui/src/utils/QueryBuilderElasticsearchFormatUtils.js, specifically in the buildEsRule() function (around line 939-946). When handling extension (custom property) fields, the code passes value[0] to buildExtensionQuery() — but for the between operator, RAQB stores the range as a flat array [from, to]. This means value[1] (the upper bound) is silently dropped before the Elasticsearch range query is built.
Why Bug #2 happens (search API not triggered):
The malformed query (missing upper bound) is structurally identical on every Apply click, so the isEqual guard in AdvanceSearchProvider's setQueryFilter short-circuits — the API call never fires because the query hasn't "changed." Fixing the range bounds automatically resolves this secondary issue.
Proposed Fix (minimal, targeted):
// In buildEsRule(), before calling buildExtensionQuery():
const isBetweenOp = ['between', 'not_between'].includes(op);
return buildExtensionQuery(
extensionPropertyName,
entityType,
isBetweenOp ? value : value[0], // pass full [from, to] for range operators
op,
not,
omPropertyType
);
This ensures buildExtensionQuery() receives the complete [from, to] array for between/not_between, while all other operators continue receiving value[0] (no regression). The downstream buildNestedTypedQuery() already handles range arrays correctly with gte/lte.
Testing plan:
- Unit tests verifying
between [5, 20]produces{gte: 5, lte: 20}in the nested range query - Unit tests for
not_betweenwith correctmust_notwrapping - E2E validation against the Advanced Search UI with number custom properties
I have experience with React, Elasticsearch query DSL, and the RAQB library. I can deliver a clean PR with tests quickly.
Could you please assign this to me? Thank you!
@Rohit0301 @PubChimps
Hi! I'd love to work on this issue and would like to get assigned to it. 🙋
I have gone through the issue description carefully and I'm confident I can tackle it effectively. I'm actively contributing to OpenMetadata and this looks like a great fit for me.
Could you please assign this issue to me? Thank you! 🚀
@mohitjeswani01 I have assigned this issue you
@mohitjeswani01 I have assigned this issue you
@Rohit0301 thanks a lot for assigning the issue i will update you shortly on the merge conflict!🙏