本文整理汇总了Python中elasticsearch.client.IndicesClient.open方法的典型用法代码示例。如果您正苦于以下问题:Python IndicesClient.open方法的具体用法?Python IndicesClient.open怎么用?Python IndicesClient.open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类elasticsearch.client.IndicesClient
的用法示例。
在下文中一共展示了IndicesClient.open方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Mapping
# 需要导入模块: from elasticsearch.client import IndicesClient [as 别名]
# 或者: from elasticsearch.client.IndicesClient import open [as 别名]
"default":{
"type":"custom",
"tokenizer":"standard",
"filter":[ "standard", "lowercase", "stop", "kstem" ]
}
}
}
})
m = Mapping('test')
m.field('f', String())
m.save(index='test', using=es)
ies.open(index='test')
es.index('test', 'test', {
'f': 'gastric adenocarcinomas',
})
es.index('test', 'test', {
'f': 'gastric adenocarcinoma',
})
es.index('test', 'test', {
'f': 'carcinomas',
})
es.index('test', 'test', {
'f': 'carcinoma',
示例2: Elasticsearch
# 需要导入模块: from elasticsearch.client import IndicesClient [as 别名]
# 或者: from elasticsearch.client.IndicesClient import open [as 别名]
parser.add_argument('--indices', dest = 'indices', action = 'store', required = True)
parser.add_argument('--snapshot', dest = 'snapshot', action = 'store', required = True)
args = parser.parse_args()
# --
# Config
config = json.load(open('config.json'))
config_private = json.load(open('config-private.json'))
# --
# Run
client = Elasticsearch([{'host' : config['ES_HOST'], 'port' : config['ES_PORT']}], timeout = 20)
sc = SnapshotClient(client)
ic = IndicesClient(client)
try:
ic.close(index = args.indices)
except:
print '! could not close index'
_ = sc.restore(
repository = config['REPO_NAME'],
snapshot = args.snapshot,
body = {"indices" : args.indices},
wait_for_completion = True
)
ic.open(index = args.indices)