PUT /new_index/
{
"settings": {
"index": {
"type": "default"
},
"number_of_shards": 5,
"number_of_replicas": 1,
"analysis": {
"filter": {
"ap_stop": {
"type": "stop",
"stopwords_path": "stoplist.txt"
},
"shingle_filter" : {
"type" : "shingle",
"min_shingle_size" : 2,
"max_shingle_size" : 5,
"output_unigrams": true
}
},
"analyzer": {
"aplyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": ["standard",
"ap_stop",
"lowercase",
"shingle_filter",
"snowball"]
}
}
}
}
}
PUT /new_index/document/_mapping/
{
"document": {
"properties": {
"text": {
"type": "string",
"store": true,
"index": "analyzed",
"term_vector": "with_positions_offsets_payloads",
"search_analyzer": "aplyzer",
"index_analyzer": "aplyzer"
},
"original_text": {
"include_in_all": false,
"type": "string",
"store": false,
"index": "not_analyzed"
},
"docid": {
"include_in_all": false,
"type": "string",
"store": true,
"index": "not_analyzed"
}
}
}
}
settings
上記のインデックスを でmappings
受け入れられるタイプに変換する必要がありelastic4s
ます。私は最新のものを使用しelastic4s
ていelasticsearch 1.5.2
ます。
ドキュメントに記載されているいくつかの例を調べましたが、この方法で作成しようとしたように、その方法がわかりません。
client.execute {
create index "new_index" mappings {
"documents" as (
"text" typed StringType analyzer ...
)
}
}
PUT リクエストで指定された 、 などのstore
使用index
方法がわかりません。term_vectors
更新: 答えに基づいて、私はこの種のものを作ることができました:
create index "new_index" shards 5 replicas 1 refreshInterval "90s" mappings {
"documents" as(
id typed StringType analyzer KeywordAnalyzer store true includeInAll false,
"docid" typed StringType index "not_analyzed" store true includeInAll false,
"original_text" typed StringType index "not_analyzed" includeInAll false,
"text" typed StringType analyzer CustomAnalyzer("aplyzer") indexAnalyzer "aplyzer" searchAnalyzer "aplyzer" store true termVector WithPositionsOffsetsPayloads
)
} analysis (
CustomAnalyzerDefinition(
"aplyzer",
StandardTokenizer,
LowercaseTokenFilter,
shingle tokenfilter "shingle_filter" minShingleSize 2 maxShingleSize 5 outputUnigrams true
)
)
私が今理解できないのは、スノーボール ステマーとストップ ワードのファイル パスをaplyzer
アナライザーに追加する方法です。
どうすればいいですか?