Feature 'featureFlag.autocomplete.enabled' does not work.
The GC team initiated testing for a new feature 'featureFlag.autocomplete.enabled.' Following the documentation guidelines, we configured the 'featureFlag.bagOfWords.enabled' flag with a value of 'true' on the Indexer Service and set 'featureFlag.autocomplete.enabled' to 'true' as well. Unfortunately, the integration test did not yield the expected results.
To investigate the issue further, we carefully examined the index from the Elasticsearch.
{
"osdu-search1709032988256-test-data--integration-1.0.1": {
"aliases": {
"a1632179934": {
},
"a1632185707": {
}
},
"mappings": {
"dynamic": "false",
"properties": {
"acl": {
"properties": {
"owners": {
"type": "keyword"
},
"viewers": {
"type": "keyword"
}
}
},
"ancestry": {
"properties": {
"parents": {
"type": "keyword"
}
}
},
"authority": {
"type": "constant_keyword",
"value": "osdu"
},
"bagOfWords": {
"type": "text",
"store": true,
"fields": {
"autocomplete": {
"type": "completion",
"analyzer": "simple",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
}
},
"createTime": {
"type": "date"
},
"createUser": {
"type": "keyword"
},
"data": {
"properties": {
"Basin": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256
},
"keywordLower": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256,
"normalizer": "lowercase"
}
},
"copy_to": [
"bagOfWords"
]
},
"Center": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256
},
"keywordLower": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256,
"normalizer": "lowercase"
}
},
"copy_to": [
"bagOfWords"
]
},
"Country": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256
},
"keywordLower": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256,
"normalizer": "lowercase"
}
},
"copy_to": [
"bagOfWords"
]
},
"County": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256
},
"keywordLower": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256,
"normalizer": "lowercase"
}
},
"copy_to": [
"bagOfWords"
]
},
"DblArray": {
"type": "double"
},
"EmptyAttribute": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256
},
"keywordLower": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256,
"normalizer": "lowercase"
}
},
"copy_to": [
"bagOfWords"
]
},
"Established": {
"type": "date"
},
"Field": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256
},
"keywordLower": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256,
"normalizer": "lowercase"
}
},
"copy_to": [
"bagOfWords"
]
},
"Location": {
"type": "geo_point"
},
"OriginalOperator": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256
},
"keywordLower": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256,
"normalizer": "lowercase"
}
},
"copy_to": [
"bagOfWords"
]
},
"Rank": {
"type": "integer"
},
"Score": {
"type": "integer"
},
"State": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256
},
"keywordLower": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256,
"normalizer": "lowercase"
}
},
"copy_to": [
"bagOfWords"
]
},
"WellName": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256
},
"keywordLower": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256,
"normalizer": "lowercase"
}
},
"copy_to": [
"bagOfWords"
]
},
"WellStatus": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256
},
"keywordLower": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256,
"normalizer": "lowercase"
}
},
"copy_to": [
"bagOfWords"
]
},
"WellType": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256
},
"keywordLower": {
"type": "keyword",
"null_value": "null",
"ignore_above": 256,
"normalizer": "lowercase"
}
},
"copy_to": [
"bagOfWords"
]
}
}
},
"id": {
"type": "keyword"
},
"index": {
"properties": {
"lastUpdateTime": {
"type": "date"
},
"statusCode": {
"type": "integer"
},
"trace": {
"type": "text"
}
}
},
"kind": {
"type": "keyword"
},
"legal": {
"properties": {
"legaltags": {
"type": "keyword"
},
"otherRelevantDataCountries": {
"type": "keyword"
},
"status": {
"type": "keyword"
}
}
},
"modifyTime": {
"type": "date"
},
"modifyUser": {
"type": "keyword"
},
"namespace": {
"type": "keyword"
},
"source": {
"type": "constant_keyword",
"value": "search1709032988256"
},
"tags": {
"type": "flattened"
},
"type": {
"type": "keyword"
},
"version": {
"type": "long"
},
"x-acl": {
"type": "keyword"
}
}
},
"settings": {
"index": {
"routing": {
"allocation": {
"include": {
"_tier_preference": "data_content"
}
}
},
"refresh_interval": "30s",
"number_of_shards": "1",
"provided_name": "osdu-search1709032988256-test-data--integration-1.0.1",
"creation_date": "1709032992807",
"number_of_replicas": "1",
"uuid": "rpIKCM9NRmm3gb41_7algw",
"version": {
"created": "7171799"
}
}
}
}
}
As far as we can determine, the Indexer has introduced a new block:
"bagOfWords": {
"type": "text",
"store": true,
"fields": {
"autocomplete": {
"type": "completion",
"analyzer": "simple",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
}
}
Acknowledged that the implementation is in accordance with the documentation.
The new request to the Search Service has been reviewed.
{
"offset":0,
"kind":"osdu:search1709032988256:test-data--Integration:1.0.1",
"limit":0,
"query":"data.OriginalOperator:OFFICE4",
"suggestPhrase":"data",
"returnHighlightedFields":false,
"highlightedFields":[
],
"returnedFields":[
],
"queryAsOwner":false,
"trackTotalCount":false
}
A request from the Search Service to the Elasticsearch:
SearchRequest{searchType=QUERY_THEN_FETCH, indices=[osdu-search1709032988256-test-data--integration-1.0.1,-.*,-system-meta-data-*], indicesOptions=IndicesOptions[ignore_unavailable=true, allow_no_indices=true, expand_wildcards_open=true, expand_wildcards_closed=false, expand_wildcards_hidden=false, allow_aliases_to_multiple_indices=true, forbid_closed_indices=true, ignore_aliases=false, ignore_throttled=true], types=[], routing='null', preference='null', requestCache=null, scroll=null, maxConcurrentShardRequests=0, batchedReduceSize=512, preFilterShardSize=null, allowPartialSearchResults=null, localClusterAlias=null, getOrCreateAbsoluteStartMillis=-1, ccsMinimizeRoundtrips=true, source={"from":0,"size":10,"timeout":"1m","query":{"bool":{"must":[{"bool":{"must":[{"query_string":{"query":"data.OriginalOperator:OFFICE4","fields":[],"type":"best_fields","default_operator":"or","max_determinized_states":10000,"allow_leading_wildcard":false,"enable_position_increments":true,"fuzziness":"AUTO","fuzzy_prefix_length":0,"fuzzy_max_expansions":50,"phrase_slop":0,"escape":false,"auto_generate_synonyms_phrase_query":true,"fuzzy_transpositions":true,"boost":1.0}}],"adjust_pure_negative":true,"boost":1.0}}],"filter":[{"terms":{"x-acl":["data.test-users-data-root
truncated...
Notably, the recent request from the Search Service to Elasticsearch lacks a field identified as 'autocomplete.'
Additionally, we have identified a method, org.opengroup.osdu.search.util.SuggestionsQueryUtil#getSuggestions, which seems to contain the logic related to suggestions.
public SuggestBuilder getSuggestions(String suggestPhrase) {
if (!autocompleteFeatureFlag.isFeatureEnabled(AUTOCOMPLETE_FEATURE_NAME) || suggestPhrase == null || suggestPhrase == "") {
return null;
}
SuggestionBuilder suggestionBuilder = SuggestBuilders.completionSuggestion(
"bagOfWords.autocomplete"
).text(suggestPhrase).skipDuplicates(true);
SuggestBuilder suggestBuilder = new SuggestBuilder();
suggestBuilder.addSuggestion(SUGGESTION_NAME, suggestionBuilder);
return suggestBuilder;
}
I suppose this method can be used when we create a request to Elastic Search, but this method will be run ONLY Junit tests.
To sum up, this feature 'featureFlag.autocomplete', perhaps, has not been implemented. Please, play an attention for it.