Skip to content
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

Merged
merged 3 commits into from
Jul 24, 2024

Conversation

rbhavna
Copy link
Collaborator

@rbhavna rbhavna commented Jul 23, 2024

Description

update config index mappings to use correct field types.

In 2.13, config index mapping was updated with three new fields configuration, type, and last_update_timebut 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

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

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.

@jngz-es
Copy link
Collaborator

jngz-es commented Jul 23, 2024

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:
Copy link
Collaborator

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?

@rbhavna rbhavna temporarily deployed to ml-commons-cicd-env July 23, 2024 20:57 — with GitHub Actions Inactive
@rbhavna rbhavna temporarily deployed to ml-commons-cicd-env July 23, 2024 20:58 — with GitHub Actions Inactive
Signed-off-by: Bhavana Ramaram <[email protected]>
@rbhavna rbhavna temporarily deployed to ml-commons-cicd-env July 23, 2024 21:04 — with GitHub Actions Inactive
@rbhavna rbhavna temporarily deployed to ml-commons-cicd-env July 23, 2024 21:04 — with GitHub Actions Inactive
@rbhavna
Copy link
Collaborator Author

rbhavna commented Jul 23, 2024

Hi @rbhavna , I don't quite get why we change the field names for the type and configuration. Could you explain a little bit?

added details to PR description

@rbhavna rbhavna temporarily deployed to ml-commons-cicd-env July 23, 2024 22:04 — with GitHub Actions Inactive
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";
Copy link
Collaborator

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?

Copy link
Collaborator Author

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

@ylwu-amzn ylwu-amzn merged commit 1926699 into opensearch-project:main Jul 24, 2024
6 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 24, 2024
* 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)
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 24, 2024
* 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)
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 24, 2024
* 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)
rbhavna added a commit that referenced this pull request Jul 24, 2024
* 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]>
rbhavna added a commit that referenced this pull request Jul 24, 2024
* 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]>
rbhavna added a commit that referenced this pull request Jul 24, 2024
* 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]>
mingshl pushed a commit to mingshl/ml-commons that referenced this pull request Jul 24, 2024
…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]>
@b4sjoo b4sjoo added the v2.16.0 Issues targeting release v2.16.0 label Jul 26, 2024
@@ -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);
Copy link
Collaborator

@ylwu-amzn ylwu-amzn Sep 3, 2024

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);
}

Copy link
Collaborator

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)
Copy link
Collaborator

@ylwu-amzn ylwu-amzn Sep 3, 2024

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)

dhrubo-os pushed a commit to dhrubo-os/ml-commons that referenced this pull request Oct 2, 2024
…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]>
dhrubo-os added a commit that referenced this pull request Oct 2, 2024
… (#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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants