## django-elastic (delastic)
* Simple way to index/delete/update django models
* Queries Elasticsearch only, not hitting the Django database
* Define the mapping with elasticsearch-dsl, defaults to basic field types.
* Override field values.
* Define if a model instance should be index or not
TODO:
* Search view:
* Elasticsearch based pagination
* Elasticsearch-dsl queries
* Adds search filters and possible values in the template context
* Support multiple models per doc_type
## Requirements
* elasticsearch-dsl
## Installation
pip install django-elastic
## Settings
INSTALLED_APPS = (
...
'delastic',
)
Optional elasticsearch settings, Defaults to the following
DJANGO_ELASTIC = {
'hosts': ['localhost'],
'port': 9200,
'index': 'django',
}
## Model
An example model
class Article(models.Model):
title = models.CharField(max_length=500, blank=True, null=True)
desc = models.TextField(blank=True, null=True)
created = models.DateTimeField(blank=True, null=True)
updated = models.DateTimeField(blank=True, null=True)
image = models.URLField(max_length=500, blank=True, null=True)
url = models.URLField(max_length=500, blank=True, null=True)
active = models.BooleanField(default=True)
def __unicode__(self):
return self.title
## Indexer
The simplest example of an indexer for the model.
from delastic.indexer import ModelIndex
class ArticleIndex(ModelIndex):
class Meta:
model = Article
## View
TODO...
## Management Commands
Create mapping in elasticsearch
./manage.py create_elastic_mapping
Index models in elasticsearch
./manage.py create_elastic_index
Metadata
Release files for django-elastic 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_elastic-0.0.1-py2-none-any.whl | Python 2 | none | any | Details for django_elastic-0.0.1-py2-none-any.whl |
Release files / django_elastic-0.0.1-py2-none-any.whl
| Download URL | django_elastic-0.0.1-py2-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
0310fc5afd895172b5c0fb963c87f42b4681444fb084ca8fb18493d698920d39
|
|
BLAKE2b-256 checksum How to use checksums |
6afa3a9b1b7c0c07f631d5af6b3bbb2725b7d6e6ac8d6cd124e23488ab0eeda2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-elastic 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.