django haystack elasticsearch multiple search fields -
i have implemented haystack search engine 2 models. models meant searched within same field ok. want different search index new model , index has no connection first 2 , used on different page different search field. don't know how this. read can use 2 engines this, after settings don't know how tell in views use different model second search.
haystack_connections = { 'default': { 'engine': 'haystack.backends.elasticsearch_backend.elasticsearchsearchengine', 'url': 'http://127.0.0.1:9200/', 'index_name': 'haystack', 'excluded_indexes': ['names.search_indexes.namesindex'], }, 'autocomplete': { 'engine': 'haystack.backends.elasticsearch_backend.elasticsearchsearchengine', 'url': 'http://127.0.0.1:9200/', 'index_name': 'autcomplete', 'excluded_indexes': ['players.search_indexes.playersindex', 'allauth.search_indexes.userindex'], } }
like this:
from haystack.query import searchqueryset sqs = searchqueryset(using='autocomplete')
Comments
Post a Comment