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


Python ES.create_index_if_missing方法代码示例

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


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

示例1: setup_store

# 需要导入模块: from pyes import ES [as 别名]
# 或者: from pyes.ES import create_index_if_missing [as 别名]
def setup_store():
    connection = ES(settings.THUMBNAIL_ELASTIC_SEARCH_SERVERS)
    try:
        connection.create_index_if_missing(settings.THUMBNAIL_ELASTIC_SEARCH_INDEX)
    except:
        pass
    try:
        connection.put_mapping(settings.THUMBNAIL_ELASTIC_SEARCH_DOCUMENT_TYPE,
                               settings.THUMBNAIL_ELASTIC_SEARCH_MAPPING,
                               indexes=[settings.THUMBNAIL_ELASTIC_SEARCH_INDEX,])
    except:
        pass
开发者ID:OnSpin,项目名称:sorl-thumbnail,代码行数:14,代码来源:elasticsearch_kvstore.py

示例2: main

# 需要导入模块: from pyes import ES [as 别名]
# 或者: from pyes.ES import create_index_if_missing [as 别名]
def main(options):
    es = ES([options.es_server])
    try:
        es.create_index_if_missing('bzcache')
    except ElasticSearchException:
        # create_index_if_missing is supposed not to raise if the index
        # already existing, but with the ancient pyes / ES server versions
        # we're using it still does.
        pass

    # re-cache all intermittent-failure bugs
    bzcache = BugzillaCache(es_server=options.es_server)
    bzcache.index_bugs_by_keyword('intermittent-failure')
开发者ID:jonallengriffin,项目名称:bzcache,代码行数:15,代码来源:bz_cache_refresh.py

示例3: handle

# 需要导入模块: from pyes import ES [as 别名]
# 或者: from pyes.ES import create_index_if_missing [as 别名]
    def handle(self, *args, **kwargs):
        init_all = kwargs.get('all')
        
        elastic = ES(settings.SEARCH_HOSTS)
        aliases = settings.SEARCH_ALIASES if init_all else args
        indices_new = []

        for alias in aliases:
            index_new = '%s_%d' % (alias, int(time.time()))
            indices_new.append(index_new)
            
            elastic.create_index_if_missing(index_new)
            elastic.add_alias(alias, [index_new])

        if len(aliases):
            elastic.put_mapping('job', {'job':{'properties':mapping}}, indices_new)
            self.stdout.write("Successfully created indices mapping.\n")

        elastic.connection.close()
开发者ID:7loops,项目名称:zaposlim.se,代码行数:21,代码来源:search_init.py

示例4: Flask

# 需要导入模块: from pyes import ES [as 别名]
# 或者: from pyes.ES import create_index_if_missing [as 别名]
#import logging

from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.assets import Environment
from pyes import ES

from datawire import default_settings

#logging.basicConfig(level=logging.WARN)

app = Flask(__name__)
app.config.from_object(default_settings)
app.config.from_envvar('DATAWIRE_SETTINGS', silent=True)

db = SQLAlchemy(app)
assets = Environment(app)

elastic_index = app.config.get('ELASTICSEARCH_INDEX', 'datawire')
elastic = ES(app.config.get('ELASTICSEARCH_SERVER', '127.0.0.1:9200'),
             default_indices=elastic_index)
elastic.create_index_if_missing(elastic_index)

#js = Bundle('jquery.js', 'base.js', 'widgets.js',
#            filters='jsmin', output='gen/packed.js')
#assets.register('js_all', js)
开发者ID:backgroundcheck,项目名称:datawi.re,代码行数:28,代码来源:core.py


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