Index schema
An index schema contains indexed fields and property fields. Indexed fields tokenize text to enable search. Property fields are used for statistics, sorting, filtering, and aggregation.
Types that can be used as indexed fields
INT, INT_ARRAY, TEXT, SHORT_TEXT, LITERAL, LITERAL_ARRAY, TIMESTAMP, GEO_POINT
Types that cannot be used as indexed fields
FLOAT, FLOAT_ARRAY, DOUBLE, DOUBLE_ARRAY
Types that can be used as property fields
INT, INT_ARRAY, LITERAL, LITERAL_ARRAY, FLOAT, FLOAT_ARRAY, DOUBLE, DOUBLE_ARRAY, TIMESTAMP, GEO_POINT
Types that cannot be used as property fields
TEXT, SHORT_TEXT
Compound indexes
A compound index combines multiple fields of the same type, such as TEXT or SHORT_TEXT, into a single index for queries. This differs slightly from running an OR query across multiple indexes.
Assume an application has two indexes and one compound index, with the following corresponding fields:
title_index - title, body_index - body, union_index - title and body
Consider a document with the following content:
id:123456,title:Open,body:SearchWhen you query using these indexes:
# OR query on two indexes - No results are retrieved
query=title_index:'OpenSearch' OR body_index:'OpenSearch'
# Compound index - The document is retrieved
query=union_index:'OpenSearch' Note:
Fields in a compound index must have the same type. Mixing types, such as SHORT_TEXT and TEXT, is not supported.
The built-in default index can only contain TEXT fields.
Analysis methods
A text analyzer tokenizes text for retrieval. It supports multiple languages and industries, such as Chinese, English, IT, E-commerce, and education. It also enables exact match for numbers and fixed-length characters, fuzzy match, and range search for locations, times, and numbers.
Property fields
Usage: Use property fields in `filter`, `aggregate`, `sort`, and `distinct` clauses for filtering, statistics, and sorting. For example: `filter=id>100000`.