Ejemplo n.º 1
0
def create_new_index(index_name=None):
    """
    Create a new index for addons in ES.

    Intended to be used by reindexation (and tests), generally a bad idea to
    call manually.
    """
    if index_name is None:
        index_name = AddonIndexer.get_index_alias()

    index_settings = copy.deepcopy(INDEX_SETTINGS)

    if waffle.switch_is_active('es-use-classic-similarity'):
        # http://bit.ly/es5-similarity-module-docs
        index_settings['similarity'] = {
            'default': {
                'type': 'classic'
            }
        }

    config = {
        'mappings': get_mappings(),
        'settings': {
            # create_index will add its own index settings like number of
            # shards and replicas.
            'index': index_settings
        },
    }
    create_index(index_name, config)
Ejemplo n.º 2
0
def create_new_index(index_name=None):
    """
    Create a new index for search-related documents in ES.

    Intended to be used by reindexation (and tests), generally a bad idea to
    call manually.
    """
    if index_name is None:
        index_name = BaseSearchIndexer.get_index_alias()

    index_settings = copy.deepcopy(INDEX_SETTINGS)

    if waffle.switch_is_active('es-use-classic-similarity'):
        # http://bit.ly/es5-similarity-module-docs
        index_settings['similarity'] = {
            'default': {
                'type': 'classic'
            }
        }

    config = {
        'mappings': get_mappings(),
        'settings': {
            # create_index will add its own index settings like number of
            # shards and replicas.
            'index': index_settings
        },
    }
    create_index(index_name, config)
Ejemplo n.º 3
0
def create_new_index(index_name=None):
    if index_name is None:
        index_name = get_alias()
    config = {
        'mappings': get_mappings(),
    }
    create_index(index_name, config)
Ejemplo n.º 4
0
def create_new_index(index=None, config=None):
    if config is None:
        config = {}
    if index is None:
        index = get_alias()
    config['mappings'] = get_mappings()
    create_index(index, config)
Ejemplo n.º 5
0
def create_new_index(index_name=None):
    if index_name is None:
        index_name = get_alias()
    config = {
        'mappings': get_mappings(),
    }
    create_index(index_name, config)
Ejemplo n.º 6
0
 def create_new_index(cls, index_name):
     config = {
         'mappings': {
             cls.get_doctype_name(): cls.get_mapping()
         }
     }
     create_index(index_name, config)
Ejemplo n.º 7
0
def create_new_index(index_name=None, config=None):
    if config is None:
        config = {}
    if index_name is None:
        index_name = get_alias()
    config['mappings'] = get_mappings()
    create_index(index_name, config)
Ejemplo n.º 8
0
def create_new_index(index=None, config=None):
    if config is None:
        config = {}
    if index is None:
        index = get_alias()
    config['settings'] = {'index': INDEX_SETTINGS}
    config['mappings'] = get_mappings()
    create_index(index, config)
Ejemplo n.º 9
0
def create_new_index(index=None, config=None):
    if config is None:
        config = {}
    if index is None:
        index = get_alias()
    config['settings'] = {'index': INDEX_SETTINGS}
    config['mappings'] = get_mappings()
    create_index(index, config)
Ejemplo n.º 10
0
def create_new_index(index_name=None, config=None):
    """
    Create a new index for search-related documents in ES.

    Intended to be used by reindexation (and tests), generally a bad idea to
    call manually.
    """
    if config is None:
        config = {}
    if index_name is None:
        index_name = BaseSearchIndexer.get_index_alias()
    config['settings'] = {'index': INDEX_SETTINGS}
    config['mappings'] = get_mappings()
    create_index(index_name, config)
Ejemplo n.º 11
0
def create_new_index(index_name=None, config=None):
    """
    Create a new index for search-related documents in ES.

    Intended to be used by reindexation (and tests), generally a bad idea to
    call manually.
    """
    if config is None:
        config = {}
    if index_name is None:
        index_name = BaseSearchIndexer.get_index_alias()
    config['settings'] = {'index': INDEX_SETTINGS}
    config['mappings'] = get_mappings()
    create_index(index_name, config)
Ejemplo n.º 12
0
def create_new_index(index_name=None):
    """
    Create a new index for search-related documents in ES.

    Intended to be used by reindexation (and tests), generally a bad idea to
    call manually.
    """
    if index_name is None:
        index_name = BaseSearchIndexer.get_index_alias()

    config = {
        'mappings': get_mappings(),
        'settings': {
            # create_index will add its own index settings like number of
            # shards and replicas.
            'index': INDEX_SETTINGS
        },
    }
    create_index(index_name, config)
Ejemplo n.º 13
0
def create_new_index(index_name=None):
    """
    Create a new index for search-related documents in ES.

    Intended to be used by reindexation (and tests), generally a bad idea to
    call manually.
    """
    if index_name is None:
        index_name = BaseSearchIndexer.get_index_alias()

    config = {
        'mappings': get_mappings(),
        'settings': {
            # create_index will add its own index settings like number of
            # shards and replicas.
            'index': INDEX_SETTINGS
        },
    }
    create_index(index_name, config)
Ejemplo n.º 14
0
    def create_new_index(cls, index_name):
        """
        Create a new index for addons in ES.

        Intended to be used by reindexation (and tests), generally a bad idea
        to call manually.
        """
        index_settings = copy.deepcopy(cls.index_settings)

        config = {
            'mappings': {
                cls.get_doctype_name(): cls.get_mapping(),
            },
            'settings': {
                # create_index will add its own index settings like number of
                # shards and replicas.
                'index': index_settings
            },
        }
        create_index(index_name, config)
Ejemplo n.º 15
0
def create_new_index(index_name=None):
    """
    Create a new index for addons in ES.

    Intended to be used by reindexation (and tests), generally a bad idea to
    call manually.
    """
    if index_name is None:
        index_name = AddonIndexer.get_index_alias()

    index_settings = copy.deepcopy(INDEX_SETTINGS)

    config = {
        'mappings': get_mappings(),
        'settings': {
            # create_index will add its own index settings like number of
            # shards and replicas.
            'index': index_settings
        },
    }
    create_index(index_name, config)