Index management in OpenSearch covers how index schemas define field types for search and filtering, how composite indexes span multiple fields, how analyzers process text and vector data, and how attribute fields support filter, sort, aggregate, and distinct operations.
Index schema
An index schema defines how OpenSearch stores and retrieves your data. It consists of two types of fields:
Index fields — analyzed during indexing and searched at query time. Use these for full-text and keyword searches.
Attribute fields — used in filter, sort, aggregation, and distinct clauses.
Field type compatibility
The following table shows which field types support indexing, attribute configuration, or both.
|
Field type |
Index field |
Attribute field |
Primary use |
|
INT |
Yes |
Yes |
Integer values; range search and filtering |
|
INT_ARRAY |
Yes |
Yes |
Arrays of integers |
|
FLOAT |
No |
Yes |
Floating-point values; sorting and aggregation only |
|
FLOAT_ARRAY |
No |
Yes |
Arrays of floats |
|
DOUBLE |
No |
Yes |
High-precision decimals; sorting and aggregation only |
|
DOUBLE_ARRAY |
No |
Yes |
Arrays of doubles |
|
TEXT |
Yes |
No |
Long-form text; full-text search with analyzer |
|
SHORT_TEXT |
Yes |
No |
Short strings; keyword and fuzzy search |
|
LITERAL |
Yes |
Yes |
Exact-match strings; filtering and search |
|
LITERAL_ARRAY |
Yes |
Yes |
Arrays of exact-match strings |
|
TIMESTAMP |
Yes |
Yes |
Time values; range search and time-based filtering |
|
GEO_POINT |
Yes |
Yes |
Geographic coordinates; location-based search |
Composite index
A composite index spans multiple TEXT or SHORT_TEXT fields. Unlike querying multiple single-field indexes with OR, a composite index treats the combined content of all its fields as a single searchable unit, so a query term that spans across fields can be matched.
Consider an application with these indexes:
title_index— index on thetitlefieldbody_index— index on thebodyfieldunion_index— composite index on bothtitleandbody
Given this document:
id:123456,title:Open,body:Search
# Querying two separate indexes with OR does not match the document.
query=title_index:'OpenSearch' OR body_index:'OpenSearch'
# Querying the composite index matches the document.
query=union_index:'OpenSearch'
The term OpenSearch cannot be found in either field alone, but the composite index finds it by searching across both fields together.
All fields in a composite index must be of the same type — either all TEXT or all SHORT_TEXT. Mixing types is not supported.
Analyzer types
Text analyzers
Text analyzers: Text analyzers segment text for retrieval across the following domains: Chinese, English, general industry, IT, e-commerce, and education. They also support:
Exact search by numeric or fixed-length value
Fuzzy search
Range search by location, time range, or numerical range
Vector analyzers
Vector analyzers retrieve documents based on multi-dimensional vectors. Two configurations are available:
General industry: retrieves documents based on multi-dimensional vectors
-
Education: retrieves general documents based on 256-dimensional vectors
Attribute fields
Attribute fields support the following clauses:
|
Clause |
Purpose |
|
|
Filter results by field value. Example: |
|
|
Compute statistics over a field |
|
|
Order results by field value |
|
|
Deduplicate results based on a field |