Comments (7)
Try adding Ad
model to related_models
in Document's Meta class.
from django-elasticsearch-dsl.
Ya I did it. But it gives error in below function
def get_instances_from_related(self, related_instance):
return related_instance.car_set.all()
saying car_set is not the option.
Does anyone face this issue and solved it?
from django-elasticsearch-dsl.
@GeorgeLubaretsi Thanks for the reply.@GeorgeLubaretsi and @alex-dotdev can you help me out in this ? Whenever I am adding ads through django admin, It should be added under car type like manufacturer. But this is not happeing.
Error - 'Ad' object has no attribute 'car_set'
from django-elasticsearch-dsl.
@codalprashant Returning self
will resolve the submission errors in the Admin. But it's still not updating the index in Elastic.
@car.doc_type
class CarDocument(DocType):
ads = fields.NestedField(properties={
'title': fields.StringField(),
'pk': fields.IntegerField(),
})
class Meta:
model = Car
related_models = [Ad]
def get_instances_from_related(self, related_instance):
return self
from django-elasticsearch-dsl.
@codalprashant Testing via the Django shell with the settings above. car.save()
works and updates the elastic index. It looks like the Signal aren't connect to the Admin panel. @sabricot Might been able to offer some advice quicker then myself.
from django-elasticsearch-dsl.
I have update the example app with a working example for this kind of relationship (when the foreign key is on the related model).
You can check here https://github.com/sabricot/django-elasticsearch-dsl/blob/master/example/test_app/documents.py.
from django-elasticsearch-dsl.
Finally Works. Thanks
from django-elasticsearch-dsl.
Related Issues (20)
- How to connect Django Backend and Elastic Search under ver 8.8.1? HOT 1
- Multi model single index possiblity HOT 2
- Multi Index Elastic Search HOT 1
- Add knn documentation HOT 2
- range fields support
- Error: Unexpected queryset model
- Showing Progress During Populate or Rebuild Commands HOT 1
- Save Only in Elasticsearch HOT 1
- ModuleNotFoundError: No module named 'MyIndex'
- elasticsearch.helpers.BulkIndexError: 1 document(s) failed to index
- How to add a mapping on the Document class HOT 1
- Cleaning up failed indexes when using `--use-alias`
- Question : Save without indexing, index a list of objects HOT 1
- Shards/Replicas setting defaults to one when populate index command without creating the index first
- failed to index
- I get connection timeout, however ES logs seems okay
- Deprecation Warning for ES v7
- Invalid metadata HOT 2
- Compatibility with django-countries HOT 3
- Data filtering function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-elasticsearch-dsl.