How to Identify Indexed Metadata Using a Background Script for External Content SearchIssue This article provides a background script that can be used to identify the metadata available in the AI Search index. The script retrieves and displays the metadata for the first 10 results returned by a query, helping administrators identify the fields available for filtering. Please adjust the script according to your requirements. The following update is mandatory: Specify the searchProfile that you want to query. Once the searchProfile is configured, the script will retrieve and display all available metadata from the AI Search index for the first 10 results returned by the query. Release<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } NA Cause<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } This script is useful when: Troubleshooting External Content Connector search resultsIdentifying metadata fields available in the search indexValidating indexed content and filtersDebugging search profile–related issues Resolution<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Navigate to System Definition > Scripts - Background.Set the scope to Global.Copy and paste the script provided below. var tableName = 'sn_ext_conn_spo_external_search_schema'; var searchProfile = 'Service Portal Default Search Profile'; var query = '***'; dumpAisDocument(tableName, 'en', searchProfile, query, true); function dumpAisDocument(tableName, locale, profile, query, includePassages) { var communicationModule = new Packages.com.glide.ais.communication.CommunicationModule(); var injector = Packages.com.google.inject.Guice.createInjector(communicationModule); var connection = injector.getProvider(Packages.com.glide.ais.communication.SearchConnection).get(); var provider = new Packages.com.glide.ais.communication.ApiClientProvider(connection); var client = provider.get("query"); var queryApi = new Packages.com.attivio.module.aisapi.v20.node.QueryApi(client); var queryRequest = new Packages.com.attivio.module.aisapi.v20.node.model.QueryRequest(); var gson = new Packages.com.google.gson.Gson(); var partitionId = Packages.com.glide.ais.common.IAisProperties.AIS_PARTITION_ID.getValue(); queryRequest.userQuery(query).locale(locale).searchProfile(profile); if (includePassages) { var holder = new Packages.com.attivio.module.aisapi.v20.node.model.ParamsHolder(); holder.putParamsItem("PostProcessSemantic.returnRawPassages", [true]); queryRequest.setRestParams(holder); } if (tableName) { queryRequest.addFiltersItem(["table", tableName].join(':')); queryRequest.addFiltersItem('"ext_content_none_access":false'); var jsObject = JSON.parse(gson.toJson(queryApi.search([queryRequest], partitionId))); gs.info("\n" + JSON.stringify(jsObject, null, 2)); } }