private function prepareFieldCondition(FieldInterface $field, $condition)
{
$queryType = QueryInterface::TYPE_TERMS;
$condition = $this->prepareCondition($condition);
if (count(array_intersect(['gt', 'gte', 'lt', 'lte'], array_keys($condition))) >= 1) {
$queryType = QueryInterface::TYPE_RANGE;
$condition = ['bounds' => $condition];
}
$condition['field'] = $field->getMappingProperty(FieldInterface::ANALYZER_UNTOUCHED);
if ($condition['field'] === null) {
$condition['field'] = $field->getMappingProperty(FieldInterface::ANALYZER_STANDARD);
}
if (in_array('queryText', array_keys($condition))) {
$queryType = QueryInterface::TYPE_MATCH;
$condition['minimumShouldMatch'] = '100%';
}
$query = $this->queryFactory->create($queryType, $condition);
if ($field->isNested()) {
$queryParams = ['path' => $field->getNestedPath(), 'query' => $query];
$query = $this->queryFactory->create(QueryInterface::TYPE_NESTED, $queryParams);
}
return $query;
}