es_jydoc.md 2.9 KB

文库jydoc mapping字段说明

字段 字段名 类型 格式化
_id 文档id string
docName 文档名 string
docTags 文档标签(多个,用逗号隔开) string
docClass 文档分类(多个,用逗号隔开) string
price 积分价格 long
downTimes 下载次数 long
viewTimes 浏览次数 long
docSummary 文档摘要 string
uploadDate 上传时间 long yyyy-MM-dd HH:mm:ss
docFileSize 文件大小 long
docPageSize 页码数 long
docFileType 文件类型 long

创建文库jydoc索引

curl -XPUT http://localhost:9200/jydoc_v1 -u elastic:elastic -H 'Content-Type:application/json' -d '{
	"mappings": {
		"properties": {
			"id": {
				"type": "keyword"
			},
			"docName": {
				"type": "text",
				"analyzer": "jieba_index",
				"index_options":"docs",
				"norms": false,
				"fields": {
					"docName_c": {
						"type": "text"
					}
				}
			},
			"docTags": {
				"type": "text",
				"analyzer": "douhao"
			},
			"docClass": {
				"type": "text",
				"analyzer": "douhao"
			},
			"price": {
				"type": "long"
			},
			"downTimes": {
				"type": "long"
			},
			"viewTimes": {
				"type": "long"
			},
			"docFileSize": {
				"type": "long"
			},
			"docPageSize": {
				"type": "long"
			},
			"docSummary": {
				"type": "text",
				"analyzer": "jieba_index",
				"index_options":"docs",
				"norms": false,
				"fields": {
					"docSummary_c": {
						"type": "text"
					}
				}
			},
			"uploadDate": {
				"type": "date",
				"format": "yyyy-MM-dd HH:mm:ss"
			},
			"docFileType": {
				"type": "long"
			},
			"previewImgId": {
				"type": "keyword"
			}
		}
	},
	"settings": {
		"index": {
			"analysis": {
				"filter": {
					"jieba_stop": {
						"type":        "stop",
						"stopwords_path": "stopwords/stopwords.txt"
					},
					"jieba_synonym": {
						"type":        "synonym",
						"synonyms_path": "synonyms/synonyms.txt"
					}
				},
				"analyzer": {
					"douhao": {
						"type": "pattern",
						"pattern": ","
					},
					"jieba_index": {
						"tokenizer": "jieba_index",
						"filter": [
							"lowercase",
							"jieba_stop",
							"jieba_synonym"
						]
					}
				}
			},
			"number_of_shards": "3",
			"number_of_replicas": "0"
		}
	}	
}'