private function prepareFieldCondition(FieldInterface $field, $condition, $currentPath)
    {
        $queryType = QueryInterface::TYPE_TERMS;
        $condition = $this->prepareCondition($condition);

        if (count(array_intersect($this->rangeConditions, array_keys($condition))) >= 1) {
            $queryType = QueryInterface::TYPE_RANGE;
            $condition = ['bounds' => $condition];
        }

        $condition['field'] = $field->getMappingProperty(FieldInterface::ANALYZER_UNTOUCHED);

        if ($condition['field'] === null || isset($condition['queryText'])) {
            $analyzer = $field->getDefaultSearchAnalyzer();
            $property = $field->getMappingProperty($analyzer);
            if ($property) {
                $condition['field'] = $property;

                if (isset($condition['queryText'])) {
                    $queryType = QueryInterface::TYPE_MATCH;
                    $condition['minimumShouldMatch'] = '100%';
                }
            }
        }

        $query = $this->queryFactory->create($queryType, $condition);

        if ($this->isNestedField($field, $currentPath)) {
            $queryParams = ['path' => $field->getNestedPath(), 'query' => $query];
            $query = $this->queryFactory->create(QueryInterface::TYPE_NESTED, $queryParams);
        }

        if (isset($condition['negative'])) {
            $query = $this->queryFactory->create(QueryInterface::TYPE_NOT, ['query' => $query]);
        }

        return $query;
    }