ADR: Create field for case insensitive search
ADR: Add keywordLower Index Mapping field
- ADR: Add keywordLower Index Mapping field
- Status
- Background
- Context & Scope
- Tradeoff Analysis
- Proposed solution
- Change Management
- Decision
- Consequences
Status
-
Proposed -
Trialing -
Under review -
Approved -
Retired
Background
Application developers would like to provide to their users a simple mechanism to enable searching that is much like SQL "LIKE" queries with lower function. Currently, none of the existing ElasticSearch fields implement this.
Context & Scope
Requirements
The desire is to support the following search query:
{
"kind": "osdu:wks:master-data--Well:1.0.0",
"query": "data.FacilityName.keywordLower:exam*"
}
Which would return
{
"results": [
{
"data": {
"FacilityName": "Example test"
},
"id": "osdu:master-data--Well:1012"
}
]
}
Tradeoff Analysis
Proposed solution
A field in the index called keywordLower in which all input is normalized to lower case. For example, this mapping in master-data--Well would be created:
"CurrentOperatorID": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256
},
"keywordLower": {
"type": "keyword",
"normalizer": "lowercase",
"null_value": "null",
"ignore_above": 256
}
}
},
The 'keywordLower' field is added and has the additional attribute: "normalizer": "lowercase"
Change Management
- Operators may need to re-ingest data or update the index. Is it possible to "patch" data to re-run the indexer on data already ingested?
Decision
Consequences
- The indexer code changes should have no noticeable impact on the system or applications (only additional property created).
- The index will be larger with the addition of the many instances of this field.
Draft MR: !618 (merged)
Edited by Mark Chance