{"size":{{ size | tojson }},"track_total_hits":{{ track_total_hits | tojson }},"query":{"bool":{"filter":[{% for filter in filters %}{"{{ filter.op }}":{ {{ filter.field | tojson }}:{{ filter.value | tojson }} }}{% if not loop.last %},{% endif %}{% endfor %}],"must":[{"multi_match":{"fields":["title^5","brand^3","canonical_text^3","description"],"operator":{{ operator | tojson }},"query":{{ text | tojson }}}}]{% if persona or sort == 'recommended' %},"should":[{% if persona %}{"multi_match":{"boost":0.35,"fields":["title^5","brand^3","canonical_text^3","description"],"operator":"or","query":{{ persona | tojson }}}}{% if sort == 'recommended' %},{% endif %}{% endif %}{% if sort == 'recommended' %}{"rank_feature":{"boost":0.2,"field":"quality_score"}},{"rank_feature":{"boost":0.05,"field":"freshness_score"}},{"rank_feature":{"boost":0.02,"field":"seller_score"}}{% endif %}]{% endif %}}}{% if sort == 'price_asc' %},"sort":[{"price":{"order":"asc"}},{"_score":{"order":"desc"}}]{% elif sort == 'newest' %},"sort":[{"listed_at":{"order":"desc"}},{"_score":{"order":"desc"}}]{% elif sort == 'price_drop' %},"sort":[{"old_price":{"missing":"_last","order":"desc"}},{"_score":{"order":"desc"}}]{% endif %}}