Example #1
0
def es_index(mock_elastic_index):
    # Create the index.
    index = Index()
    index_name = index.timestamped_index()
    index.create_index(index_name)
    index.update_aliases(index_name)
    # Update mapping
    proj = ProjectIndex()
    proj.put_mapping()
    page = PageIndex()
    page.put_mapping()
    sec = SectionIndex()
    sec.put_mapping()

    yield index
    index.delete_index(index_name=index_name)
def es_index(mock_elastic_index):
    # Create the index.
    index = Index()
    index_name = index.timestamped_index()
    index.create_index(index_name)
    index.update_aliases(index_name)
    # Update mapping
    proj = ProjectIndex()
    proj.put_mapping()
    page = PageIndex()
    page.put_mapping()
    sec = SectionIndex()
    sec.put_mapping()

    yield index
    index.delete_index(index_name=index_name)
    def handle(self, *args, **options):
        """Provision new ES instance"""
        index = Index()
        index_name = index.timestamped_index()

        log.info("Creating indexes..")
        index.create_index(index_name)
        index.update_aliases(index_name)

        log.info("Updating mappings..")
        proj = ProjectIndex()
        proj.put_mapping()
        page = PageIndex()
        page.put_mapping()
        sec = SectionIndex()
        sec.put_mapping()
        log.info("Done!")
from readthedocs.search.indexes import Index, PageIndex, ProjectIndex, SectionIndex

# Create the index.
index = Index()
index_name = index.timestamped_index()
index.create_index(index_name)
index.update_aliases(index_name)
# Update mapping
proj = ProjectIndex()
proj.put_mapping()
page = PageIndex()
page.put_mapping()
sec = SectionIndex()
sec.put_mapping()