ЗАДАЧА РЕШЕНА = Лишние скобки у should
Собственно ошибка
'error' => [
'error' => [
'root_cause' => [
[
'type' => 'x_content_parse_exception',
'reason' => '[1:182] [bool] failed to parse field [should]',
],
],
'type' => 'x_content_parse_exception',
'reason' => '[1:182] [bool] failed to parse field [must]',
'caused_by' => [
'type' => 'x_content_parse_exception',
'reason' => '[1:182] [bool] failed to parse field [should]',
'caused_by' => [
'type' => 'illegal_state_exception',
'reason' => 'expected value but got [START_ARRAY]',
],
],
],
'status' => 400,
],
А вот сам запрос
[
'url' => 'shop_items/_search',
'method' => 'POST',
'data' => [
'query' => [
'bool' => [
'must' => [
[
'match' => [
'available' => 1,
],
],
[
'fuzzy' => [
'search_keywords' => [
'value' => 'набор',
'fuzziness' => 'auto',
'prefix_length' => 0,
],
],
],
[
'bool' => [
'should' => [
[
[
'span_near' => [
'clauses' => [
[
'span_multi' => [
'match' => [
'fuzzy' => [
'search_keywords' => [
'value' => 'набор',
'fuzziness' => 2,
],
],
],
],
],
[
'span_multi' => [
'match' => [
'fuzzy' => [
'search_keywords' => [
'value' => 'набор',
'fuzziness' => 2,
],
],
],
],
],
],
'slop' => 0,
'in_order' => false,
],
],
],
],
],
],
],
],
],
'aggs' => [
'shop_category' => [
'terms' => [
'field' => 'shop_category',
'size' => 1000,
],
],
'max_price' => [
'max' => [
'field' => 'price',
],
],
'min_price' => [
'min' => [
'field' => 'price',
],
],
'colors' => [
'terms' => [
'field' => 'color.title.keyword',
'size' => 100,
],
'aggs' => [
'colors_slug' => [
'terms' => [
'field' => 'color.slug.keyword',
'size' => 100,
],
],
],
],
'gender' => [
'terms' => [
'field' => 'gender.title.keyword',
'size' => 100,
],
'aggs' => [
'genders_slug' => [
'terms' => [
'field' => 'gender.slug.keyword',
'size' => 100,
],
],
],
],
'provider' => [
'terms' => [
'field' => 'provider.title.keyword',
'size' => 100,
],
'aggs' => [
'providers_slug' => [
'terms' => [
'field' => 'provider.slug.keyword',
'size' => 100,
],
],
],
],
'vendor' => [
'terms' => [
'field' => 'vendor.title.keyword',
'size' => 100,
],
'aggs' => [
'vendors_slug' => [
'terms' => [
'field' => 'vendor.slug.keyword',
'size' => 100,
],
],
],
],
'material' => [
'terms' => [
'field' => 'material.title.keyword',
'size' => 100,
],
'aggs' => [
'materials_slug' => [
'terms' => [
'field' => 'material.slug.keyword',
'size' => 100,
],
],
],
],
'size' => [
'terms' => [
'field' => 'size.title.keyword',
'size' => 100,
],
'aggs' => [
'sizes_slug' => [
'terms' => [
'field' => 'size.slug.keyword',
'size' => 100,
],
],
],
],
'country' => [
'terms' => [
'field' => 'country.title.keyword',
'size' => 100,
],
'aggs' => [
'countrys_slug' => [
'terms' => [
'field' => 'country.slug.keyword',
'size' => 100,
],
],
],
],
],
'size' => 48,
'from' => 1,
],
'error' => [
'error' => [
'root_cause' => [
[
'type' => 'x_content_parse_exception',
'reason' => '[1:182] [bool] failed to parse field [should]',
],
],
'type' => 'x_content_parse_exception',
'reason' => '[1:182] [bool] failed to parse field [must]',
'caused_by' => [
'type' => 'x_content_parse_exception',
'reason' => '[1:182] [bool] failed to parse field [should]',
'caused_by' => [
'type' => 'illegal_state_exception',
'reason' => 'expected value but got [START_ARRAY]',
],
],
],
'status' => 400,
],
]