-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update config index mappings to use correct field types #2710
Conversation
Signed-off-by: Bhavana Ramaram <[email protected]>
Hi @rbhavna , I don't quite get why we change the field names for the type and configuration. Could you explain a little bit? |
case CONFIGURATION_FIELD: | ||
configuration = Configuration.parse(parser); | ||
break; | ||
case ML_CONFIGURATION_FIELD: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another field added in 2.13, LAST_UPDATE_TIME_FIELD
, let's use similar way to fix?
Signed-off-by: Bhavana Ramaram <[email protected]>
Signed-off-by: Bhavana Ramaram <[email protected]>
added details to PR description |
public static final String CREATE_TIME_FIELD = "create_time"; | ||
public static final String LAST_UPDATE_TIME_FIELD = "last_update_time"; | ||
|
||
public static final String LAST_UPDATED_TIME_FIELD = "last_updated_time"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to reuse the old Field names for CX experience BWC, rather than defining new ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using old names and trying to update their types is failing. OpenSearch does not allow conversion between certain types and flat_object is one of them
* update config index mappings to use with correct field types Signed-off-by: Bhavana Ramaram <[email protected]> * enable dynamic mapping for config index Signed-off-by: Bhavana Ramaram <[email protected]> * change last_update_time field Signed-off-by: Bhavana Ramaram <[email protected]> --------- Signed-off-by: Bhavana Ramaram <[email protected]> (cherry picked from commit 1926699)
* update config index mappings to use with correct field types Signed-off-by: Bhavana Ramaram <[email protected]> * enable dynamic mapping for config index Signed-off-by: Bhavana Ramaram <[email protected]> * change last_update_time field Signed-off-by: Bhavana Ramaram <[email protected]> --------- Signed-off-by: Bhavana Ramaram <[email protected]> (cherry picked from commit 1926699)
* update config index mappings to use with correct field types Signed-off-by: Bhavana Ramaram <[email protected]> * enable dynamic mapping for config index Signed-off-by: Bhavana Ramaram <[email protected]> * change last_update_time field Signed-off-by: Bhavana Ramaram <[email protected]> --------- Signed-off-by: Bhavana Ramaram <[email protected]> (cherry picked from commit 1926699)
* update config index mappings to use with correct field types Signed-off-by: Bhavana Ramaram <[email protected]> Signed-off-by: Bhavana Ramaram <[email protected]> (cherry picked from commit 1926699) Co-authored-by: Bhavana Ramaram <[email protected]>
* update config index mappings to use with correct field types Signed-off-by: Bhavana Ramaram <[email protected]> Signed-off-by: Bhavana Ramaram <[email protected]> (cherry picked from commit 1926699) Co-authored-by: Bhavana Ramaram <[email protected]>
* update config index mappings to use with correct field types Signed-off-by: Bhavana Ramaram <[email protected]> Signed-off-by: Bhavana Ramaram <[email protected]> (cherry picked from commit 1926699) Co-authored-by: Bhavana Ramaram <[email protected]>
…roject#2710) * update config index mappings to use with correct field types Signed-off-by: Bhavana Ramaram <[email protected]> * enable dynamic mapping for config index Signed-off-by: Bhavana Ramaram <[email protected]> * change last_update_time field Signed-off-by: Bhavana Ramaram <[email protected]> --------- Signed-off-by: Bhavana Ramaram <[email protected]>
@@ -78,10 +85,10 @@ public void writeTo(StreamOutput out) throws IOException { | |||
public XContentBuilder toXContent(XContentBuilder xContentBuilder, Params params) throws IOException { | |||
XContentBuilder builder = xContentBuilder.startObject(); | |||
if (type != null) { | |||
builder.field(TYPE_FIELD, type); | |||
builder.field(CONFIG_TYPE_FIELD, type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before this PR
"type" : "os_query_assist_ppl_agent",
"configuration" : {
"agent_id" : "qdFHuZEBJv7K-ogaOTOB"
}
Now we have
"config_type" : "os_query_assist_ppl_agent",
"ml_configuration" : {
"agent_id" : "qdFHuZEBJv7K-ogaOTOB"
}
This is a breaking change.
How about changing to
if (type != null) {
builder.field(TYPE_FIELD, type);
}
if (configType != null) {
builder.field(CONFIG_TYPE_FIELD, type);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for line 91, that's also breaking
default: | ||
parser.skipChildren(); | ||
break; | ||
} | ||
} | ||
return MLConfig.builder() | ||
.type(type) | ||
.configuration(configuration) | ||
.type(configType == null ? type : configType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parse new field value to new field
.type(type)
.configType(configType)
…roject#2710) (opensearch-project#2718) * update config index mappings to use with correct field types Signed-off-by: Bhavana Ramaram <[email protected]> Signed-off-by: Bhavana Ramaram <[email protected]> (cherry picked from commit 1926699) Co-authored-by: Bhavana Ramaram <[email protected]>
… (#3053) * update config index mappings to use with correct field types (cherry picked from commit 1926699) Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Co-authored-by: Bhavana Ramaram <[email protected]>
Description
update config index mappings to use correct field types.
In 2.13, config index mapping was updated with three new fields
configuration
,type
, andlast_update_time
but schema version was not bumped. Due to which, the domains which were upgraded to 2.13 from previous versions did not go through update index mapping as they did not detect a schema version bump.During indexing, these fields got created with wrong types not as specified in the mapping. Now when such domains are going to upgrade to 2.15, with schema_version bump, the index mapping tries to get updated but will throw exception since the field types for the three fields specified above are different. Hence the index initialization fails and indexing into the
config
index wouldn't be possible.Hence, the PR tries to add complete new fields(
ml_configuration
,config_type
,last_updated_time
while removing the old ones. So whenever mapping is getting updated, since there is no type-conflict for old fields, they get retained in the index as is while new fields get added. It is therefore suggested to start using these new fields from 2.15 while indexing into config index.Issues Resolved
#2630
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.