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

Star tree mapping changes #14261

Closed

Conversation

bharath-techie
Copy link
Contributor

@bharath-techie bharath-techie commented Jun 13, 2024

Description

This PR contains the changes for star tree field mapping with feature flag protection. To make the changes extensible to other multi-field/composite/datacube type of indices in future, I've generalized the implementation under 'CompositeIndex'.

Mappings have a new section 'composite' under which multi field mappings such as 'star tree' can be defined. All the fields associated with metrics and dimensions must be present in 'properties' section. [ This is even applicable for update mapping API - but right now , its blocked for star tree - star tree can be only specified during creation of index ]

Min version :

"mappings": {
        "dynamic": "strict",
        "_source": {
            "enabled": true
        },
        "composite": {
            "startree1": {
                "type": "star_tree",
                "config": {
                    "ordered_dimensions": [
                       {
                        "name": "@timestamp"
                       },
                       {
                        "name": "status"
                       }
                    ],
                    "metrics": [
                      {
                        "name": "size"
                       },
                       {
                        "name": "request_rate"
                       }
                    ]
                }
            }
        },
        "properties": {
            "@timestamp": {
                "format": "strict_date_optional_time||epoch_second",
                "type": "date"
            },
            --------
            
        }
    }

}

And the defaults will be filled for the above fields.

NOTE : We will tune the defaults throughout the development of the star tree index.

Defaults :
Timestamp field intervals = [ Minute, Hour ]
Default Metrics for each metric field = [ SUM, COUNT, AVG, MIN, MAX ]

Complete version :

"mappings": {
        "dynamic": "strict",
        "_source": {
            "enabled": true
        },
        "composite": {
            "startree1": {
                "type": "star_tree",
                "config": {
                    "ordered_dimensions": [
                        {
                            "name": "timestamp",
                            "calendar_intervals": [
                                "day",
                                "month"
                            ]
                        },
                        {
                            "name": "size"
                        }
                    ],
                    "metrics": [
                        {
                            "name": "size",
                            "stats": [
                                "sum",
                                "avg",
                                "min"
                            ]
                        }
                    ]
                }
            }
        },
        "properties": {
            "@timestamp": {
                "format": "strict_date_optional_time||epoch_second",
                "type": "date"
            }
           -----------
        }
    }

Validations

Apart from basic validations based on user input :

- We will start with support for one field mapping under composite index , so technically one star tree index per source index.
- Maximum of 10 dimensions [will fine tune this]
- For date fields - maximum for 3 intervals
- All dimension fields and metric fields must be aggregation compatible [ doc values + field data supported ]
- We will add a limit on number of metrics later on.

Open questions

  • Saw sort valiadations on 'shrink index' api etc - where I'll also add similar validations. What other index APIs we need to restrict creation / support of star tree ?

Related Issues

#13875
#14386

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

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.

Copy link
Contributor

❌ Gradle check result for 1bb63c7: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@bharath-techie bharath-techie force-pushed the startreemapping branch 2 times, most recently from 682ba9f to 79f9970 Compare June 13, 2024 07:08
Copy link
Contributor

❌ Gradle check result for 79f9970: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 682ba9f: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for ccccf2d: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
Copy link

codecov bot commented Jun 25, 2024

Codecov Report

Attention: Patch coverage is 68.75000% with 160 lines in your changes missing coverage. Please review.

Project coverage is 71.80%. Comparing base (243e8db) to head (b813450).
Report is 5 commits behind head on main.

Files Patch % Lines
...siteindex/datacube/startree/StarTreeValidator.java 5.26% 34 Missing and 2 partials ⚠️
...java/org/opensearch/index/mapper/ObjectMapper.java 43.39% 19 Missing and 11 partials ⚠️
...va/org/opensearch/index/mapper/StarTreeMapper.java 81.16% 21 Missing and 8 partials ⚠️
...ndex/compositeindex/datacube/DimensionFactory.java 58.62% 8 Missing and 4 partials ⚠️
.../datacube/startree/StarTreeFieldConfiguration.java 72.72% 6 Missing and 3 partials ⚠️
...ompositeindex/datacube/startree/StarTreeField.java 80.00% 2 Missing and 5 partials ⚠️
...h/index/compositeindex/CompositeIndexSettings.java 50.00% 5 Missing and 1 partial ⚠️
.../index/compositeindex/CompositeIndexValidator.java 25.00% 5 Missing and 1 partial ⚠️
...nsearch/index/mapper/CompositeMappedFieldType.java 64.70% 6 Missing ⚠️
...ensearch/index/compositeindex/datacube/Metric.java 80.00% 1 Missing and 3 partials ⚠️
... and 8 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #14261      +/-   ##
============================================
+ Coverage     71.70%   71.80%   +0.09%     
- Complexity    62213    62337     +124     
============================================
  Files          5125     5139      +14     
  Lines        292473   292982     +509     
  Branches      42258    42340      +82     
============================================
+ Hits         209719   210362     +643     
+ Misses        65486    65297     -189     
- Partials      17268    17323      +55     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@mgodwan mgodwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall. Few minor comments only.

Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
Copy link
Contributor

❌ Gradle check result for 0a28513: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 92b8480: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
Copy link
Contributor

❌ Gradle check result for 7ae98db: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

✅ Gradle check result for ed01cc0: SUCCESS

Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
Copy link
Contributor

✅ Gradle check result for b813450: SUCCESS

Copy link
Contributor

github-actions bot commented Jul 1, 2024

✅ Gradle check result for b813450: SUCCESS

@bharath-techie bharath-techie mentioned this pull request Jul 1, 2024
3 tasks
@bharath-techie
Copy link
Contributor Author

Closed this PR as there was bug on resolving conversations. Still this can be seen in this PR , if navigated to 'coversations' drop down as part of 'Files changed' tab.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants