本文整理汇总了Python中mkt.webapps.models.WebappIndexer.get_mapping方法的典型用法代码示例。如果您正苦于以下问题:Python WebappIndexer.get_mapping方法的具体用法?Python WebappIndexer.get_mapping怎么用?Python WebappIndexer.get_mapping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mkt.webapps.models.WebappIndexer
的用法示例。
在下文中一共展示了WebappIndexer.get_mapping方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_mapping_properties
# 需要导入模块: from mkt.webapps.models import WebappIndexer [as 别名]
# 或者: from mkt.webapps.models.WebappIndexer import get_mapping [as 别名]
def test_mapping_properties(self):
# Spot check a few of the key properties.
mapping = WebappIndexer.get_mapping()
keys = mapping['webapp']['properties'].keys()
for k in ('id', 'app_slug', 'category', 'default_locale',
'description', 'device', 'features', 'name', 'status'):
ok_(k in keys, 'Key %s not found in mapping properties' % k)
示例2: create_index
# 需要导入模块: from mkt.webapps.models import WebappIndexer [as 别名]
# 或者: from mkt.webapps.models.WebappIndexer import get_mapping [as 别名]
def create_index(new_index, alias, settings):
"""Creates a mapping for the new index.
- new_index: new index name
- alias: alias name
- settings: a dictionary of settings
"""
sys.stdout.write(
'Create the mapping for index %r, alias: %r' % (new_index, alias))
# Update settings with mapping.
settings = {
'settings': settings,
'mappings': WebappIndexer.get_mapping(),
}
# Create index and mapping.
try:
ES.create_index(new_index, settings)
except pyelasticsearch.exceptions.IndexAlreadyExistsError:
raise CommandError('New index [%s] already exists' % new_index)
# Don't return until the health is green. By default waits for 30s.
ES.health(new_index, wait_for_status='green', wait_for_relocating_shards=0)
示例3: test_mapping
# 需要导入模块: from mkt.webapps.models import WebappIndexer [as 别名]
# 或者: from mkt.webapps.models.WebappIndexer import get_mapping [as 别名]
def test_mapping(self):
mapping = WebappIndexer.get_mapping()
eq_(mapping.keys(), ['webapp'])
eq_(mapping['webapp']['_all'], {'enabled': False})
eq_(mapping['webapp']['_boost'], {'name': '_boost', 'null_value': 1.0})