如何将以下设置添加到python flex 搜索模块。请提供一个例子。我已经创建了索引和映射。但是我坚持设置。
curl -XPUT "http://localhost:9200/blurays " -d'
{
"settings": {
"analysis": {
"filter": {
"nGram_filter": {
"type": "nGram",
"min_gram": 2,
"max_gram": 20,
"token_chars": [
"letter",
"digit",
"punctuation",
"symbol"
]
}
},
"analyzer": {
"nGram_analyzer": {
"type": "custom",
"tokenizer": "whitespace",
"filter": [
"lowercase",
"asciifolding",
"nGram_filter"
]
},
"whitespace_analyzer": {
"type": "custom",
"tokenizer": "whitespace",
"filter": [
"lowercase",
"asciifolding"
]
}
}
}
},
最佳答案
您可以使用 elasticsearch.indices.create
并将设置作为正文传递。
Docs说:
创建(* args,** kwargs)
在Elasticsearch中创建索引。 http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html
参数:
因此,您可以将
body
与settings参数一起传递。关于python - Elasticsearch “settings ”在Python模块中添加,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27242679/