本文整理汇总了Python中arches.app.search.search_engine_factory.SearchEngineFactory.create_index方法的典型用法代码示例。如果您正苦于以下问题:Python SearchEngineFactory.create_index方法的具体用法?Python SearchEngineFactory.create_index怎么用?Python SearchEngineFactory.create_index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arches.app.search.search_engine_factory.SearchEngineFactory
的用法示例。
在下文中一共展示了SearchEngineFactory.create_index方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: prepare_resource_relations_index
# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
def prepare_resource_relations_index(create=False):
"""
Creates the settings and mappings in Elasticsearch to support related resources
"""
index_settings = {
'mappings': {
'all': {
'properties': {
'resourcexid': {'type': 'keyword'},
'notes': {'type': 'text'},
'relationshiptype': {'type': 'keyword'},
'resourceinstanceidfrom': {'type': 'keyword'},
'resourceinstanceidto': {'type': 'keyword'},
'created': {'type': 'keyword'},
'modified': {'type': 'keyword'}
}
}
}
}
if create:
se = SearchEngineFactory().create()
se.create_index(index='resource_relations', body=index_settings, ignore=400)
return index_settings
示例2: prepare_resource_relations_index
# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
def prepare_resource_relations_index(self, create=False):
"""
Creates the settings and mappings in Elasticsearch to support related resources
"""
index_settings = {
'mappings':{
'all': {
'properties': {
'resourcexid': {'type': 'long'},
'notes': { 'type': 'string'},
'relationshiptype': {'type': 'string', 'index' : 'not_analyzed'},
'entityid2': {'type': 'string', 'index' : 'not_analyzed'},
'entityid1': {'type': 'string', 'index' : 'not_analyzed'}
}
}
}
}
if create:
se = SearchEngineFactory().create()
se.create_index(index='resource_relations', body=index_settings, ignore=400)
return index_settings
示例3: prepare_search_index
# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
def prepare_search_index(self, resource_type_id, create=False):
"""
Creates the settings and mappings in Elasticsearch to support resource search
"""
index_settings = super(Resource, self).prepare_search_index(resource_type_id, create=False)
index_settings['mappings'][resource_type_id]['properties']['date_groups'] = {
'properties' : {
'conceptid': {'type' : 'string', 'index' : 'not_analyzed'}
}
}
#index_settings['mappings'][resource_type_id]['properties']['measurement_groups'] = {
# 'properties' : {
# 'conceptid': {'type' : 'string', 'index' : 'not_analyzed'}
# }
#}
if create:
se = SearchEngineFactory().create()
try:
se.create_index(index='entity', body=index_settings)
except:
index_settings = index_settings['mappings']
se.create_mapping(index='entity', doc_type=resource_type_id, body=index_settings)
示例4: setUpClass
# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
def setUpClass(cls):
se = SearchEngineFactory().create()
se.delete_index(index="concept_labels")
se.delete_index(index="term")
se.create_index(index="concept_labels")
se.create_index(index="term")
management.call_command(
"packages", operation="import_json", source="tests/fixtures/resource_graphs/archesv4_resource.json"
)
示例5: prepare_term_index
# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
def prepare_term_index(self, create=False):
"""
Creates the settings and mappings in Elasticsearch to support term search
"""
index_settings = {
'settings':{
'analysis': {
'analyzer': {
'folding': {
'tokenizer': 'standard',
'filter': [ 'lowercase', 'asciifolding' ]
}
}
}
},
'mappings':{
'value':{
'properties': {
'ids':{'type': 'string', 'index' : 'not_analyzed'},
'context':{'type': 'string', 'index' : 'not_analyzed'},
'term': {
'type': 'string',
'analyzer': 'standard',
'fields': {
'folded': {
'type': 'string',
'analyzer': 'folding'
}
}
}
}
}
}
}
if create:
se = SearchEngineFactory().create()
se.create_index(index='term', body=index_settings, ignore=400)
return index_settings
示例6: prepare_search_index
# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
#.........这里部分代码省略.........
'filter': [ 'lowercase', 'asciifolding' ]
}
}
}
},
'mappings': {
resource_type_id : {
'properties' : {
'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
'property' : {'type' : 'string', 'index' : 'not_analyzed'},
'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
'value' : {'type' : 'string', 'index' : 'not_analyzed'},
'label' : {'type' : 'string', 'index' : 'not_analyzed'},
'primaryname': {'type' : 'string', 'index' : 'not_analyzed'},
'child_entities' : {
'type' : 'nested',
'index' : 'analyzed',
'properties' : {
'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
'property' : {'type' : 'string', 'index' : 'not_analyzed'},
'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
'label' : {'type' : 'string', 'index' : 'not_analyzed'},
'value' : {
'type' : 'string',
'index' : 'analyzed',
'fields' : {
'raw' : { 'type' : 'string', 'index' : 'not_analyzed'},
'folded': { 'type': 'string', 'analyzer': 'folding'}
}
}
}
},
'domains' : {
'type' : 'nested',
'index' : 'analyzed',
'properties' : {
'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
'property' : {'type' : 'string', 'index' : 'not_analyzed'},
'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
'label' : {'type' : 'string', 'index' : 'not_analyzed'},
'value' : {
'type' : 'string',
'index' : 'analyzed',
'fields' : {
'raw' : { 'type' : 'string', 'index' : 'not_analyzed'}
}
},
'conceptid' : {'type' : 'string', 'index' : 'not_analyzed'},
}
},
'geometries' : {
'type' : 'nested',
'index' : 'analyzed',
'properties' : {
'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
'property' : {'type' : 'string', 'index' : 'not_analyzed'},
'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
'label' : {'type' : 'string', 'index' : 'not_analyzed'},
'value' : {
"type": "geo_shape"
}
}
},
'dates' : {
'type' : 'nested',
'index' : 'analyzed',
'properties' : {
'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
'property' : {'type' : 'string', 'index' : 'not_analyzed'},
'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
'label' : {'type' : 'string', 'index' : 'not_analyzed'},
'value' : {
"type" : "date"
}
}
}
}
}
}
}
if create:
se = SearchEngineFactory().create()
try:
se.create_index(index='entity', body=index_settings)
except:
index_settings = index_settings['mappings']
se.create_mapping(index='entity', doc_type=resource_type_id, body=index_settings)
return index_settings
示例7: tearDownClass
# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
def tearDownClass(cls):
se = SearchEngineFactory().create()
se.delete_index(index='strings')
se.create_index(index='strings')
示例8: prepare_search_index
# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
#.........这里部分代码省略.........
'strings' : {
'type' : 'nested',
'properties': {
'string': {
'type' : 'text',
'index' : 'analyzed',
'fields' : {
'raw' : {'type': 'keyword'},
'folded': { 'type': 'text', 'analyzer': 'folding'}
}
},
'nodegroup_id' : {'type': 'keyword'},
'provisional': {'type': 'keyword'}
}
},
'domains' : {
'type' : 'nested',
'properties' : {
'value' : {
'type' : 'text',
'index' : 'analyzed',
'fields' : {
'raw' : {'type': 'keyword'}
}
},
'conceptid' : {'type': 'keyword'},
'valueid' : {'type': 'keyword'},
'nodegroup_id' : {'type': 'keyword'},
'provisional': {'type': 'keyword'}
}
},
'geometries' : {
'type' : 'nested',
'properties': {
'geom': {
'properties': {
'features': {
'properties': {
'geometry': {'type': 'geo_shape'},
'id': {'type': 'keyword'},
'type': {'type': 'keyword'},
'properties': {
'enabled': False
}
}
},
'type': {'type': 'keyword'}
}
},
'nodegroup_id' : {'type': 'keyword'},
'provisional': {'type': 'keyword'}
}
},
'points': {
'type' : 'nested',
'properties' : {
'point' : {'type': 'geo_point'},
'nodegroup_id' : {'type': 'keyword'},
'provisional': {'type': 'keyword'}
}
},
'dates' : {
'type' : 'nested',
'properties' : {
'date' : {'type': 'float'},
'nodegroup_id' : {'type': 'keyword'},
'nodeid' : {'type': 'keyword'},
'provisional': {'type': 'keyword'}
}
},
'numbers' : {
'type' : 'nested',
'properties' : {
'number' : {'type': 'double'},
'nodegroup_id' : {'type': 'keyword'},
'provisional': {'type': 'keyword'}
}
},
'date_ranges': {
'type' : 'nested',
'properties' : {
'date_range' : {'type': 'float_range'},
'nodegroup_id' : {'type': 'keyword'},
'provisional': {'type': 'keyword'}
}
}
}
}
}
}
if create:
se = SearchEngineFactory().create()
try:
se.create_index(index='resource', body=index_settings)
except:
index_settings = index_settings['mappings']
se.create_mapping(index='resource', doc_type=resource_model_id, body=index_settings)
return index_settings
示例9: prepare_term_index
# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
def prepare_term_index(create=False):
"""
Creates the settings and mappings in Elasticsearch to support term search
"""
index_settings = {
'settings': {
'analysis': {
'analyzer': {
'folding': {
'tokenizer': 'standard',
'filter': [ 'lowercase', 'asciifolding' ]
}
}
}
},
'mappings': {
'term': {
'properties': {
'nodegroupid': {'type': 'keyword'},
'tileid': {'type': 'keyword'},
'nodeid': {'type': 'keyword'},
'resourceinstanceid': {'type': 'keyword'},
'provisional': {'type': 'keyword'},
'value': {
'analyzer': 'standard',
'type': 'text',
'fields': {
'raw': {'type': 'keyword'},
'folded': {
'analyzer': 'folding',
'type': 'text'
}
}
}
}
},
'concept': {
'properties': {
'top_concept': {'type': 'keyword'},
'conceptid': {'type': 'keyword'},
'language': {'type': 'keyword'},
'id': {'type': 'keyword'},
'category': {'type': 'keyword'},
'provisional': {'type': 'keyword'},
'type': {'type': 'keyword'},
'value': {
'analyzer': 'standard',
'type': 'text',
'fields': {
'raw': {'type': 'keyword'},
'folded': {
'analyzer': 'folding',
'type': 'text'
}
}
}
}
}
}
}
if create:
se = SearchEngineFactory().create()
se.create_index(index='strings', body=index_settings)
return index_settings
示例10: tearDownClass
# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
def tearDownClass(cls):
se = SearchEngineFactory().create()
se.delete_index(index="concept_labels")
se.delete_index(index="term")
se.create_index(index="concept_labels")
se.create_index(index="term")
示例11: base_prepare_search_index
# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
#.........这里部分代码省略.........
}
}
}
},
'mappings': {
resource_type_id : {
'properties' : {
'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
'property' : {'type' : 'string', 'index' : 'not_analyzed'},
'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
'value' : {'type' : 'string', 'index' : 'not_analyzed'},
'label' : {'type' : 'string', 'index' : 'not_analyzed'},
'primaryname': {'type' : 'string', 'index' : 'not_analyzed'},
'child_entities' : {
'type' : 'nested',
'index' : 'analyzed',
'properties' : {
'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
'property' : {'type' : 'string', 'index' : 'not_analyzed'},
'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
'label' : {'type' : 'string', 'analyzer': 'ducet_sort'},
'value' : {
'type' : 'string',
"index_analyzer": "index_ngram",
"search_analyzer": "search_ngram",
'fields' : {
'raw' : { 'type' : 'string', 'index' : 'not_analyzed'},
'folded': { 'type': 'string', 'analyzer': 'folding'}
}
}
}
},
'domains' : {
'type' : 'nested',
'index' : 'analyzed',
'properties' : {
'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
'property' : {'type' : 'string', 'index' : 'not_analyzed'},
'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
'label' : {'type' : 'string', 'analyzer': 'ducet_sort'},
'value' : {
'type' : 'string',
'index' : 'analyzed',
'fields' : {
'raw' : { 'type' : 'string', 'index' : 'not_analyzed'}
}
},
'conceptid' : {'type' : 'string', 'index' : 'not_analyzed'},
}
},
'geometries' : {
'type' : 'nested',
'index' : 'analyzed',
'properties' : {
'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
'property' : {'type' : 'string', 'index' : 'not_analyzed'},
'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
'label' : {'type' : 'string', 'index' : 'not_analyzed'},
'value' : {
"type": "geo_shape"
}
}
},
'dates' : {
'type' : 'nested',
'index' : 'analyzed',
'properties' : {
'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
'property' : {'type' : 'string', 'index' : 'not_analyzed'},
'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
'label' : {'type' : 'string', 'index' : 'not_analyzed'},
'value' : {
"type" : "date"
}
}
}
}
}
}
}
if create:
se = SearchEngineFactory().create()
try:
se.create_index(index='entity', body=index_settings)
except:
index_settings = index_settings['mappings']
se.create_mapping(index='entity', doc_type=resource_type_id, body=index_settings)
return index_settings