File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
src/django_elasticsearch_dsl_drf Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 1111
1212from six import PY3
1313
14+ from .versions import ELASTICSEARCH_GTE_7_0
1415
1516__title__ = 'django_elasticsearch_dsl_drf.helpers'
1617__author__ = 'Artur Barseghyan <[email protected] >' @@ -146,14 +147,17 @@ def more_like_this(obj,
146147 if max_doc_freq is not None :
147148 kwargs ['max_doc_freq' ] = max_doc_freq
148149
150+ _like_options = {
151+ '_id' : "{}" .format (obj .pk ),
152+ '_index' : "{}" .format (_index ),
153+ }
154+ if not ELASTICSEARCH_GTE_7_0 :
155+ _like_options .update ({'_type' : "{}" .format (_mapping )})
156+
149157 return _search .query (
150158 MoreLikeThis (
151159 fields = fields ,
152- like = {
153- '_id' : "{}" .format (obj .pk ),
154- '_index' : "{}" .format (_index ),
155- '_type' : "{}" .format (_mapping )
156- },
160+ like = _like_options ,
157161 ** kwargs
158162 )
159163 )
You can’t perform that action at this time.
0 commit comments