All Products
Search
Document Center

Schema

Last Updated: Sep 09, 2021

Description

The schema of an OpenSearch application.

Example

{
    "tables": {
        "main": {
            "primaryTable": true,
            "name": "main",
            "fields": {
                "id": {
                    "name": "id",
                    "type": "LITERAL",
                    "primaryKey": true
                },
                "title": {
                    "name": "title",
                    "type": "TEXT",
                    "primaryKey": false
                },
                "buy": {
                    "name": "buy",
                    "type": "INT",
                    "primaryKey": false
                },
                "cate_id": {
                    "name": "cate_id",
                    "type": "INT",
                    "primaryKey": false
                },
                "cate_name": {
                    "name": "cate_name",
                    "type": "LITERAL",
                    "primaryKey": false
                }
            }
        }
    },
    "indexes": {
        "searchFields": {
            "id": {
                "fields": [
                    "id"
                ]
            },
            "default": {
                "fields": [
                    "title"
                ],
                "analyzer": "chn_standard"
            },
            "cate_name": {
                "fields": [
                    "cate_name"
                ]
            }
        },
        "filterFields": [
            "id",
            "buy",
            "cate_id",
            "cate_name"
        ]
    }
}

Structure

Field

Type

Description

tables

Object

The tables of the application.

tables.*

Object

The details about a table. For more information, see the "Table" section. The asterisk (*) indicates the name of the table.

indexes

Object

The indexes of the application. For more information, see the "Index" section.

Table

Example

{
    "primaryTable": true,
    "name": "main",
    "fields": {
        "id": {
            "name": "id",
            "type": "LITERAL",
            "primaryKey": true
        },
        "title": {
            "name": "title",
            "type": "TEXT",
            "primaryKey": false
        },
        "buy": {
            "name": "buy",
            "type": "INT",
            "primaryKey": false
        },
        "cate_id": {
            "name": "cate_id",
            "type": "INT",
            "primaryKey": false
        },
        "cate_name": {
            "name": "cate_name",
            "type": "LITERAL",
            "primaryKey": false
        }
    }
}

Structure

Field

Type

Description

fields

Object

The fields of the application.

fields.*

Object

The details about a field. For more information, see the "Field" section. The asterisk (*) indicates the name of the field.

primaryTable

Boolean

Indicates whether the table is the primary table.

name

String

The name of the table.

Field

Example

{
  "type": "INT",
  "name": "id",
  "primaryKey": true,
  "joinWith":["other_table"]
}

Structure

Field

Type

Description

type

String

The type of the field. For more information about field types, see Fields and analyzers.

name

String

The name of the field.

primaryKey

Boolean

Indicates whether the field is a primary key field.

joinWith

Array

The tables that are joined to secondary tables.

Index

Example

{
    "searchFields": {
      "default": {
        "fields": [
          "title"
        ],
        "analyzer": "chn_standard"
      },
      "id": {
        "fields": [
          "id"
        ]
      }
    },
    "filterFields": [
      "id"
    ]
}

Structure

Field

Type

Description

filterFields

Array

The list of attribute fields.

searchFields

Object

The information about index fields.

searchFields.*

Object

The details about an index field. For more information, see the "SearchField" section. The asterisk (*) indicates the name of the index field.

SearchField

Example

{
  "fields": ["title"],
  "analyzer": "chn_standard"
}

Structure

Field

Type

Description

fields

Array

The list of index fields.

analyzer

String

The value of the analyzer field can be one of the values described in the "Custom analyzers" and "Built-in analyzers" sections.

Built-in analyzers

Analyzer

Description

chn_standard

The common analyzer for Chinese text.

simple

The analyzer for specific scenarios.

chn_single

The analyzer for single Chinese characters.

eng_standard

The analyzer for stemming English words.

eng_nostem

The analyzer that retains roots of English words

fuzzy

The analyzer for fuzzy searches.

keyword

The analyzer for keywords.

chn_ecommerce

The analyzer for Chinese text from the E-commerce industry.

chn_film

The analyzer for Chinese text from videos.

chn_scene_name

The analyzer for person names in Chinese.

chn_scene_org

The analyzer for organization names in Chinese.

first_letter

The analyzer for simple pinyin spelling.

full_pinyin

The analyzer for full pinyin spelling.

numeric

The analyzer for searches by range.

geo

The analyzer for searches by the range of geographical locations.

chn_it_content

The analyzer for IT-related text.