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
分析器?
我应该怎么做?