当前位置: 首页>>代码示例>>Python>>正文


Python IndicesClient.close方法代码示例

本文整理汇总了Python中elasticsearch.client.IndicesClient.close方法的典型用法代码示例。如果您正苦于以下问题:Python IndicesClient.close方法的具体用法?Python IndicesClient.close怎么用?Python IndicesClient.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在elasticsearch.client.IndicesClient的用法示例。


在下文中一共展示了IndicesClient.close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Elasticsearch

# 需要导入模块: from elasticsearch.client import IndicesClient [as 别名]
# 或者: from elasticsearch.client.IndicesClient import close [as 别名]
from elasticsearch import Elasticsearch
from elasticsearch.client import IndicesClient
from elasticsearch_dsl import Mapping, String, Search

es = Elasticsearch()
ies = IndicesClient(es)

ies.delete('test')
ies.create('test')
ies.close('test')

ies.put_settings(index='test', body={
    "analysis":{
      "analyzer":{
        "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')
开发者ID:lpenguin,项目名称:python-notebooks,代码行数:32,代码来源:elastic_test.py

示例2: get_client_and_close_indices

# 需要导入模块: from elasticsearch.client import IndicesClient [as 别名]
# 或者: from elasticsearch.client.IndicesClient import close [as 别名]
 def get_client_and_close_indices(es, indices):
     indices_client = IndicesClient(es)
     indices_client.close(indices)
     return indices_client
开发者ID:kkrampa,项目名称:commcare-hq,代码行数:6,代码来源:restore_es_snapshot.py

示例3: Elasticsearch

# 需要导入模块: from elasticsearch.client import IndicesClient [as 别名]
# 或者: from elasticsearch.client.IndicesClient import close [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)
开发者ID:bkj,项目名称:es-backup,代码行数:32,代码来源:s3_restore.py


注:本文中的elasticsearch.client.IndicesClient.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。