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

Integrate ElasticSearch and include component template for the “power saving status table” #83

Closed
4 tasks done
PrathibaJee opened this issue Nov 26, 2023 · 2 comments

Comments

@PrathibaJee
Copy link
Collaborator

PrathibaJee commented Nov 26, 2023

  • Integrate Elasticsearch service from onf-core-model-ap/applicationPattern/services/ElasticsearchService
  • Include Elasticsearch preparation during the startup of the application to point to the expected index-alias as specified in the LAYER_PROTOCOL_NAME_TYPE_ELASTICSEARCH_LAYER instance,

ElasticSearch preparation shall include the following functionality ,

  • Configuration of index template. If a index is not available , create an index as per the alias mentioned in the config file.
  • Include a component template for the “power saving status table” for saving the deviation-from-original-state modules-to-restore-original-state information & with the following entry ,
{
        name: 'aips-pss-mappings',
        body: {
            template: {
                mappings: {
                    properties: {
                        'link-id': { type: 'keyword' },
                        'deviation-from-original-state-list': { type: text }, // should not be type: 'flattened'as the list is not an object
                        'modules-to-restore-original-state-list': { type: text } // should not be type: 'flattened' as the list is not an object
                    }
                }
            }
        }
    } 

As per the expectation , 'deviation-from-original-state-list’ and ‘modules-to-restore-original-state-list’ shall be a list.
In Elasticsearch, there is no dedicated array data type. Any field can contain zero or more values by default, however, all values in the array must be of the same data type.
Reference : https://www.elastic.co/guide/en/elasticsearch/reference/current/array.html
So , defining the datatype of deviation-from-original-state and modules-to-restore-original-state of type text shall be fine.

A final entry shall be like this ,

"_source" : {
          "link-id" : "305551239",
          "deviation-from-original-state-list" : [ ],
          "module-to-restore-original-state-list" : [
            "AllTransmittersOn"
          ]
        }
@IswaryaaS
Copy link
Collaborator

IswaryaaS commented Nov 28, 2023

Included changes as part of #94.

Would test once and close the issue

@vanithavalluripalli9
Copy link
Collaborator

Fixed as part of PR #94. Tested and verified

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

No branches or pull requests

3 participants