wish helps you No need to fork Haystack, you can update that method in your own backend (for more details, see Stretching Haystack's ElasticSearch Backend). The build_search_kwargs method returns a dictionary so you can just modify the original return value. Disclaimer: this code is just an example of how you could update your own backend, not how to implement fuzzy search.
this one helps. I fell into this issue during this month. In order to perform the correct query you'll need override some haystack objects. I found this article very helpful Extending Haystack’s Elasticsearch backend. Quite complicated at the beginning, but once understand how it works... it works :-)
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from haystack.forms import SearchForm
from .backend import ElasticsearchSearchQuerySetCustom
query = self.searchqueryset.query.clean(self.cleaned_data.get('q'))
if not self.is_valid() or not query:
sqs = ElasticsearchSearchQuerySetCustom().multi_match(query, ['title^8', 'text^0.5'])
I wish did fix the issue. If you want results like "xyzapplexyz", then you would need to use ngram analyzer instead of EdgeNGram or you could use both depending on your requirements. EdgeNGram generates tokens only from the beginning. with NGram apple will be one of the generated tokens for term xyzapplexyz assuming max_gram >=5 and you will get expected results, also search_analyzer needs to be different or you will get weird results.
Highlight exact phrase with haystack/elasticsearch in Django