You can configure default display fields to specify the fields in the application schema that need to be retrieved and returned for each search request.
Configure and use default display fields in the OpenSearch console
1. Log on to the OpenSearch console. In the left-side navigation pane, choose Feature Extensions > Search Result Display. On the Search Result Display page, add default display fields in the Default Display Fields section.
2. If you do not specify default display fields on the Search Result Display page, you can add default display fields when you run a search test for an application, as shown in the following figure.
Note: Separate the values of the fetch_fields parameter with semicolons (;).
Configure default display fields by using SDKs or calling API operations
fetch_fields: The size of returned text data has a great impact on search performance. We recommend that you specify only the required fields. If you configure this parameter by using SDKs or calling API operations, the corresponding configuration in the OpenSearch console is overwritten.
API parameters: Use the fetch_fields parameter to specify the API parameters.
SDKs: The following sample code shows how to configure this parameter by calling the SDK for Java.
// Specify the fields in the application that need to be returned in the search results.
config.setFetchFields(Lists.newArrayList("id","name","phone","int_arr","literal_arr","float_arr","cate_id"));
Usage notes
If you do not specify the fetch_fields parameter by using SDKs or calling API operations, the default display fields that you configure in the OpenSearch console are returned in the search results. If you specify the fetch_fields parameter by using SDKs or calling API operations, the fields that are specified by using the fetch_fields parameter are returned in the search results.
In scenarios in which the JOIN operation is performed on multiple tables, the primary key fields in the secondary tables cannot be set as default display fields. If you want the values of the primary key fields in the secondary tables to be returned in the search results, use the associated fields in the primary table, as shown in the following figure.