fabriziofortino opened a new pull request, #3079:
URL: https://github.com/apache/jackrabbit-oak/pull/3079
## Summary
Dynamic boost properties (e.g. `predictedTagsDynamicBoost`) are indexed in
Elasticsearch
as nested documents, with one nested document per value:
```json
"predictedTagsDynamicBoost": [
{ "value": "Replacement Cost", "boost": 1 },
{ "value": "Theft", "boost": 1 },
{ "value": "Alberta", "boost": 1 },
{ "value": "GENERAL INSURANCE COMPANY", "boost": 0.988 }
]
```
For properties with many values sharing the same boost score, this creates a
large
number of nested documents, which is expensive to index and store.
This change groups values that share the same boost score into a single
nested
document, with value holding an array instead of a scalar:
```json
"predictedTagsDynamicBoost": [
{ "value": ["Replacement Cost", "Theft", "Alberta"], "boost": 1 },
{ "value": "GENERAL INSURANCE COMPANY", "boost": 0.988 }
]
```
No mapping or query changes were needed: value is a plain analyzed text
field,
which Elasticsearch accepts as an array natively, and the existing nested
match /
field_value_factor query in ElasticRequestHandler works unchanged against the
grouped structure.
Feature toggle
Guarded by FT_OAK-12353, enabled by default. Set to false at runtime to
revert
to the previous one-nested-document-per-value behavior.
A time-bombed test (ElasticDocumentTest#ft_oak_12353_toggleShouldBeRemoved)
will start
failing after 2027-08-12 as a reminder to remove the toggle and its guards
once the
grouped format has been running in production long enough.
Changes
- ElasticDocument: introduces the FT_OAK-12353 toggle; groups dynamic boost
values
by boost score in addDynamicBoostField/getProperties when enabled.
- ElasticIndexProviderService: registers the toggle on the OSGi Whiteboard.
- Tests: unit coverage for the grouping logic in ElasticDocumentTest, and
end-to-end
query coverage (grouped and ungrouped) in ElasticDynamicBoostTest.
Test plan
- [x] ElasticDocumentTest — verifies grouping by boost, single-group
unwrapping, and
toggle-disabled fallback to the original per-value nested documents
- [x] ElasticDynamicBoostTest — end-to-end query tests against a real
Elasticsearch
instance, confirming queries still match on values grouped into a shared
nested
document, both with grouping enabled (default) and disabled
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]