我在我的 django 应用程序中使用 ElasticSearch-DSL,查询仅返回 10 行。当我使用尺寸时。我收到错误“multi_match”查询不支持大小。
from django.shortcuts import render
from elasticsearch_dsl import Q
from elasticsearch_dsl.query import MultiMatch
# Create your views here.
from search.documents import CarDocument
from products.models import Products
def search(request):
q = request.GET.get('q')
if q:
#cars = CarDocument.search().query("match", model_name=q)
q = request.GET.get('q', None)
query1 = MultiMatch(query=q, fields=['product_make', 'bodystyle','model_name','variant','transmission','yom'])
s = CarDocument.search().query(query1)
cars = s.execute()
else:
cars = ''
return render(request, 'search/search.html', {'cars': cars})