All Products
Search
Document Center

Default display fields

Last Updated: Sep 09, 2021

You can set 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.1

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 (;).2

Configure default display fields by using SDKs or calling API operations

fetch_fields: The size of returned text data has a great impact on the query performance. We recommended that you obtain only the required fields. If you set this parameter by using SDKs or calling API operations, the corresponding configuration in the OpenSearch console is overwritten.

// Set 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.