SEARCH & AI / 008
AEM + Elasticsearch + Vector Search: Hybrid Retrieval
An engineering note on combining lexical and semantic retrieval over AEM content, and the relevance, freshness and governance questions to validate.
Topic map
Two signals, one ranked set
AEM Elasticsearch hybrid search
- 01Query
- 02Lexical / vector
- 03Fusion
- 04Authorization
- 05Evidence
SYSTEM OVERVIEW
Lexical and semantic candidates are complementary signals.
Conceptual hybrid retrieval. Apply mandatory scope constraints to both branches and recheck before exposing evidence.
Lexical
- Question + exact terms
- Elasticsearch lexical query
- Scoped ranked candidates
Semantic
- Question embedding
- Vector query
- Scoped ranked candidates
Combined path
- Rank fusion
- Permission recheck
- Optional reranking
- Evidence set
THIS ARTICLE EXPLORES
- Keep exact-match and semantic retrieval distinct.
- Compare rank fusion with a lexical baseline.
- Inspect filtering before and after candidate selection.
01 / PROBLEM
Exact identifiers and paraphrases fail differently.
A product code can need precise lexical matching while a paraphrased question may benefit from semantic similarity. Evaluate both classes of query instead of assuming one ranking method can replace the other.
| Input | Evidence sought | Failure signal |
|---|---|---|
| Exact identifier | The named entity or document. | Semantically similar but incorrect identifier. |
| Paraphrase | A passage expressing the same intent. | No shared terms means a missed source. |
| Ambiguous question | Evidence sufficient to disambiguate. | Confident selection without context. |
02 / HYBRID RETRIEVAL
Fuse ranks deliberately.
Lexical and vector scores do not automatically share a meaningful scale. Rank fusion combines their ordering; score combination needs calibration. Elastic documents reciprocal rank fusion as one hybrid approach. Check the target version and feature availability before choosing a query contract.
An evaluation boundary
Run each variant against the same labeled question set.
- 01Lexical baseline
- 02Semantic baseline
- 03Combined ranking
- 04Review disagreements
- 05Choose candidate budgets
03 / PERMISSIONS
Filtering changes recall as well as access.
Enforce identity-derived scope and locale constraints where candidates are generated. A post-filter that removes most of a small candidate set can leave an otherwise answerable question with no evidence. Increasing candidate budgets is not permission to disclose restricted passages.
| Placement | Benefit | Check |
|---|---|---|
| During candidate generation | Search within the allowed population. | Actual engine prefilter semantics. |
| After merge | Enforce a shared result contract. | Insufficient surviving candidates. |
| Before external reranking | Keep restricted text outside model payloads. | Payload-level negative tests. |
04 / EVALUATION
Save disagreements, not only aggregate scores.
Retain query IDs, corpus revision and ranked source IDs for review. Categorize whether a miss came from ingestion, candidate generation, fusion or reranking. Do not hide a permission error inside an average relevance score.
Illustrative comparison record
JSON{
"questionId": "q-example",
"corpusRevision": "snapshot-example",
"expectedSources": [
"guide-example"
],
"runs": [
{
"strategy": "lexical",
"rankedSources": []
},
{
"strategy": "semantic",
"rankedSources": []
},
{
"strategy": "hybrid",
"rankedSources": []
}
],
"review": "Populate from an actual experiment; no scores claimed."
}05 / TRADEOFFS
Keep a simpler rollback path.
Hybrid retrieval adds model and indexing dependencies. Preserve a tested lexical fallback only where its authorization and freshness guarantees are equivalent; an unfiltered fallback is not an acceptable degradation.
Before widening the experiment
- Review exact-name and paraphrase disagreements.
- Test restrictive scopes and empty-result cases.
- Measure retrieval and reranker costs independently.
- Verify every fallback enforces the same policy.
REFERENCE DESK
Sources & further verification
Product behavior should be checked against the target AEM and search-engine release. The design choices in this note are proposed assessment criteria, not vendor guarantees.