描述
opensearch 應用的 schema
樣本
{
"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"
]
}
}結構
欄位 | 類型 | 描述 |
tables | Object | 表結構 |
tables.* | Object | 表結構詳情,具體說明查看下文Table*:表名 |
indexes | Object | 索引結構,具體說明查看下文Index |
Table
樣本
{
"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
}
}
}結構
欄位 | 類型 | 描述 |
fields | Object | 欄位結構 |
fields.* | Object | 欄位詳情,具體說明查看下文Field*:欄位名 |
primaryTable | Boolean | 是否是主表 |
name | String | 表名 |
Field
樣本:
{
"name": "json_nested",
"type": "NESTED",
"primaryKey": false,
"innerSchema": {
"job": {
"name": "job",
"type": "TEXT",
"primaryKey": false
},
"ssn": {
"name": "ssn",
"type": "LITERAL",
"primaryKey": false
}
}
}結構
欄位 | 類型 | 描述 |
type | String | 欄位類型,詳細欄位資訊請參見應用結構。 |
name | String | 欄位名 |
primaryKey | Boolean | 是否是主鍵 |
joinWith | Array | 外錶鏈接的資料表集合 |
innerSchema | Object | 當欄位類型為 |
Index
樣本
{
"searchFields": {
"default": {
"fields": [
"title"
],
"analyzer": "chn_standard"
},
"id": {
"fields": [
"id"
]
}
},
"filterFields": [
"id"
]
}結構
欄位 | 類型 | 描述 |
filterFields | Array | 屬性欄位集合 |
searchFields | Object | 索引欄位 |
searchFields.* | Object | 索引欄位詳情,具體說明查看下文SearchField*:索引名稱 |
SearchField
樣本
{
"fields": ["title"],
"analyzer": "chn_standard"
}結構
欄位 | 類型 | 描述 |
fields | Array | 索引欄位集合 |
analyzer | String |
內建分析器
分析器 | 描述 |
chn_standard | 中文-通用分析 |
simple | 簡單分析 |
chn_single | 中文-單字分析 |
eng_standard | 英文-去詞根分析 |
eng_nostem | 英文-不去詞根分析 |
fuzzy | 模糊分析 |
keyword | 關鍵字 |
chn_ecommerce | 中文-電商分析 |
chn_film | 中文-視頻分析 |
chn_scene_name | 中文-人名分析 |
chn_scene_org | 中文-機構名分析 |
first_letter | 拼音-簡拼分析 |
full_pinyin | 拼音全拼分析 |
numeric | 數值分析 |
geo | 地理位置分析 |
chn_it_content | IT-內容分析 |