Skip to main content

Elasticsearch utils for the curator core project

Project description

Elasticsearch utils for the curator core project.

Quick start

1. Add “core_elasticsearch_app” to your INSTALLED_APPS setting

INSTALLED_APPS = [
  ...
  'core_elasticsearch_app',
]

The package should be placed above core_explore_keyword_app in the INSTALLED_APPS to enable autocomplete powered by elasticsearch.

2. Include the core_elasticsearch_app URLconf in your project urls.py

re_path(r'^elasticsearch/', include('core_elasticsearch_app.urls')),

3. Configure what should be indexed in Elasticsearch

It is recommended to configure the mapping between the CDCS templates and the Elasticsearch indices before starting to insert data, so that data can be indexed as soon as they are published in the CDCS. For that, set the following setting:

ELASTICSEARCH_AUTO_INDEX = True

Then, configure the mapping between the XSD templates and the Elasticsearch indices. Documents stored in Elasticsearch have a common structure. They are composed of a data_id, a title and a description field. A mapping can be defined to tell where in the XML data the values for the title and for the description of a resource can be found. Below is an example to set this mapping via REST, for a given template:

import requests
payload = {
    "template": "5f43ba192b8fd5c092e30e62",
    "title_path": "Resource/identity/title",
    "description_paths": ["Resource/content/description", "Resource/content/subject"],
}

requests.post(
    SERVER_URI + "/elasticsearch/rest/elasticsearch_template/", data=payload, auth=(USER, PASSWORD)
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

core_elasticsearch_app-1.0.0a5.tar.gz (15.0 kB view details)

Uploaded Source

File details

Details for the file core_elasticsearch_app-1.0.0a5.tar.gz.

File metadata

  • Download URL: core_elasticsearch_app-1.0.0a5.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.0 importlib_metadata/3.7.3 packaging/20.9 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10

File hashes

Hashes for core_elasticsearch_app-1.0.0a5.tar.gz
Algorithm Hash digest
SHA256 777c84999ac14f4c68db26cd41a9fa3cf8cf184543a5319605fc1e01e4353e46
MD5 0b5c6d595d96e53d2f74ac3e5e0ba022
BLAKE2b-256 f9efcbbdb049c8e6b6e696ec82acdc2aa08c66bda6c509e419505b9d7cf9221d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page