Creating an index

To save any order document to Order Search, create an index with a predefined schema consisting of mappings and settings by using the createSearchIndex API.

Mapping is the structure in which the order documents are stored in an index. The process of defining the mappings is made flexible to suit the customer requirements. The order fields such as billToId, shopper name, phone number, address, email, item information, and so on can be defined in the mapping with searchable, sortable and returnable characteristics. It allows you to define which fields should be numbers, dates, and so on and what should be the date format or whether the strings should be treated as full text fields and so on.

The name of the index is generated by appending the current year and month in the -YYYYMM format to the index ID (order) as a suffix. For example, order-202109. But when the property allow_clone_index_from_next_day is set to true, the year, month and date in the -yyyyMMdd format is appended to the index ID (order) as a suffix. For example order-20260212.

You can define mappings for fields by using Elasticsearch field data types. For more information about the mapping guidelines, see Creating an index mapping.

Note: Order Service does not provide an API to delete an index. To make an old or unnecessary indices inactive, remove their association with the index alias using the Elasticsearch Alias API.

If an index is created with incorrect fields or mappings, Elasticsearch does not allow any modification to the index definition once data is inserted. In such scenarios where multiple field or mapping errors exist, you must delete the index and its associated template using the Elasticsearch APIs. After deleting an index from Elasticsearch, ensure that you also remove the corresponding record from the OSS_INDEX_CONFIG table, identified by i_id='order' and i_name='<index name>'.