MyTardis
latest
  • User Guide
  • Configuration and Administration
    • Installation
    • Authentication Methods
    • Filter Setup
    • Database
    • Schema and Parameter Sets
    • Setting Up Search
      • Setting up Elasticsearch
      • Django Configuration
        • Enabling Single Search
        • Updating Indexes
    • Storage Options and Architecture in MyTardis
    • Facility Overview
    • Task Priorities
  • Development
  • Documentation for included Apps
  • Releases
MyTardis
  • Docs »
  • Configuration and Administration »
  • Setting Up Search
  • Edit on GitHub

Setting Up Search¶

Tardis comes with a single search option which provides users with a search field that returns a list of matching Experiments, Datasets and Datafiles.

The single search box uses Elasticsearch, and Django Elasticsearch DSL library that allows indexing of django models in elasticsearch, and accordingly requires some setup. The single search box is disabled by default.

Setting up Elasticsearch¶

Elasticsearch doesn’t work out of the box with MyTardis. It is not currently installed with pip and requires a number of manual steps to get working.

Elasticsearch can be found here: https://www.elastic.co/products/elasticsearch

The following are a very simple list of steps that will get everything up and running. It is advisable to follow up with the person responsible for overseeing security policy at your home institution to see if any extra setup is necessary.

Django Configuration¶

Enabling Single Search¶

A list of default settings for Single Search are already in default_settings.py in the MyTardis repository. Single search is enabled by setting the SINGLE_SEARCH_ENABLED option to True.

MyTardis comes with a search app that allows indexing Experiments, Dataset and Datafile models and also provides view and api to perform elasticsearch query on these models. This can be enabled by adding ‘tardis.apps.search’ to the list of installed apps.

Other settings are shown below:

ELASTICSEARCH_DSL Settings¶

The default value is

INSTALLED_APPS += ('django_elasticsearch_dsl','tardis.apps.search',)
ELASTICSEARCH_DSL = {
    'default': {
        'hosts': 'http://localhost:9200'
    },
}
ELASTICSEARCH_DSL_INDEX_SETTINGS = {
    'number_of_shards': 1,
    'number_of_replicas': 0
}

Updating Indexes¶

Once Elasticsearch is set up, and Single Search is enabled (i.e. the SINGLE_SEARCH_ENABLED option in settings is set to True) Elasticsearch DSL will automatically register the addition of and changes to models and reflect these in the search index. That is, as soon as a new instance of a model is added to the database, or changes are made to an existing instance, these changes will be searchable.

If you’re adding search to an existing deployment of Django then you’ll need to manually trigger a rebuild of the indexes (automatic indexing only happens through signals when models are added or changed).

Elasticsearch DSL registers a number of management commands with the Django framework, these commands can be listed by running the following command

python manage.py search_index --help

the important one here being the –rebuild command. To rebuild, navigate to your checkout and call the following command

python manage.py search_index --rebuild

Elasticsearch DSL will then ask you to confirm your decision (Note: Rebuilding will destroy your existing indexes, and will take a while for large datasets, so be sure), and then start rebuilding.

Next Previous

© Copyright 2021, MyTardis Development Team Revision 806696a5.

Built with Sphinx using a theme provided by Read the Docs.
Read the Docs v: latest
Versions
master
latest
stable
v4.6.0-rc1
v4.5.0
v4.5.0-rc5
v4.5.0-rc4
v4.5.0-rc3
v4.5.0-rc2
v4.5.0-rc1
v4.3.0
v4.3.0-rc3
v4.3.0-rc2
v4.2.0
v4.2.0-rc5
v4.2.0-rc4
v4.2.0-rc3
v4.2.0-rc2
v4.1.5
v4.1.4
v4.1.3
v4.1.2
v4.1.1
v4.1.0
v4.1.0-rc9
v4.1.0-rc5
v4.1.0-rc3
v4.1.0-rc2
v4.0.2
v4.0.1
v4.0.0
v4.0.0-rc12
v3.9.0
v3.8.1
v3.8.0
3.7.0
3.7
3.5.1
series-4.2
series-4.0
develop
add-readthedocs-config-file
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.