У меня проблема с эластичным поиском, с запросом DSL ‘mustNot’
Вот мой код:
$string = new Query\QueryString();
$string->setQuery('*');
$term = new Term();
$term->setTerm($this->attribute,$this->value);
$mustNot = new Bool();
$mustNot->addMustNot($term);
$query = new Query();
$query->setQuery($string);
$query->setPostFilter($mustNot);
return $query;
И мой результат:
SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[qqgJrK0OTGCfXPX5Yd7X3A][data_from_mapper_3][2]: SearchParseException[[data_from_mapper_3][2]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"query_string":{"query":"*"}},"post_filter":{"bool":{"must_not":[{"term":{"_score":1}}]}}}]]]; nested: SearchParseException[[data_from_mapper_3][2]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [No parser for element [post_filter]]]; }{[qqgJrK0OTGCfXPX5Yd7X3A][data_from_mapper_3][1]: SearchParseException[[data_from_mapper_3][1]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"query_string":{"query":"*"}},"post_filter":{"bool":{"must_not":[{"term":{"_score":1}}]}}}]]]; nested: SearchParseException[[data_from_mapper_3][1]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [No parser for element [post_filter]]]; }{[qqgJrK0OTGCfXPX5Yd7X3A][data_from_mapper_3][4]: SearchParseException[[data_from_mapper_3][4]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"query_string":{"query":"*"}},"post_filter":{"bool":{"must_not":[{"term":{"_score":1}}]}}}]]]; nested: SearchParseException[[data_from_mapper_3][4]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [No parser for element [post_filter]]]; }{[qqgJrK0OTGCfXPX5Yd7X3A][data_from_mapper_3][3]: SearchParseException[[data_from_mapper_3][3]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"query_string":{"query":"*"}},"post_filter":{"bool":{"must_not":[{"term":{"_score":1}}]}}}]]]; nested: SearchParseException[[data_from_mapper_3][3]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [No parser for element [post_filter]]]; }{[qqgJrK0OTGCfXPX5Yd7X3A][data_from_mapper_3][0]: SearchParseException[[data_from_mapper_3][0]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"query_string":{"query":"*"}},"post_filter":{"bool":{"must_not":[{"term":{"_score":1}}]}}}]]]; nested: SearchParseException[[data_from_mapper_3][0]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [No parser for element [post_filter]]]; }]
Задача ещё не решена.
Других решений пока нет …