1
Index metadata for search filtering
tischrei edited this page 2023-06-13 09:20:10 +00:00

The following tool is used to create an index in OpenSearch with the content of the following data:


{
    "services": [{
            "service_title": "Anti DDoS",
            "service_type": "antiddos",
            "docs": [{
                    "title": "API Reference",
                    "type": "api-ref"
                }, {
                    "title": "User Guide",
                    "type": "umn"
                }
            ]
        }, {
            "service_title": "Application Operations Management",
            "service_type": "aom",
            "docs": [{
                    "title": "API Reference",
                    "type": "api-ref"
                }, {
                    "title": "User Guide",
                    "type": "umn"
                }
            ]
        }
     ....
    ],
    "doc_types": [
        "api-ref",
        "umn",
        "dev",
        "image-creation-guide",
        "tool-guide",
        "mycredential",
        "public-images",
        "sdk-ref",
        "operation-guide",
        "operation-guide-lts",
        "parallel-file-system",
        "permissions-configuration-guide",
        "swiftapi",
        "s3api",
        ...
    ]
}

The data is then used to dynamically build the filter options for the search part of the Helpcenter website.

The tool which is used has the name index_metadata and can be found in the the tools folder.

The tool needs several env-args to run properly which can be seen with the following sample code.

Set the correct authentication variables.

python tools/index_metadata.py --hosts opensearch.eco.tsi-dev.otc-service.com:443 --target-environment public --index search_index_de --username <username> --password <password> --delete-index