protected function getQueryRange($operator, $start, $end)
    {
        $start = $this->prepareValue($start);
        $end = $this->prepareValue($end);

        $startBrace = '[';
        $startValue = '*';
        $endValue = '*';
        $endBrace = ']';

        switch ($operator) {
            case Operator::GT:
                $startBrace = '{';
                $endBrace = '}';
                // Intentionally omitted break

            case Operator::GTE:
                $startValue = $start;
                break;

            case Operator::LT:
                $startBrace = '{';
                $endBrace = '}';
                // Intentionally omitted break

            case Operator::LTE:
                $endValue = $end;
                break;

            case Operator::BETWEEN:
                $startValue = $start;
                $endValue = $end;
                break;

            default:
                throw new \RuntimeException("Unknown operator: $operator");
        }

        return "$startBrace$startValue TO $endValue$endBrace";
    }
protected function getQueryRange($operator, $start, $end)
    {
        $start = $this->prepareValue($start);
        $end = $this->prepareValue($end);

        $startBrace = '[';
        $startValue = '*';
        $endValue = '*';
        $endBrace = ']';

        switch ($operator) {
            case Operator::GT:
                $startBrace = '{';
                $endBrace = '}';
                // Intentionally omitted break

            case Operator::GTE:
                $startValue = $start;
                break;

            case Operator::LT:
                $startBrace = '{';
                $endBrace = '}';
                // Intentionally omitted break

            case Operator::LTE:
                $endValue = $end;
                break;

            case Operator::BETWEEN:
                $startValue = $start;
                $endValue = $end;
                break;

            default:
                throw new \RuntimeException("Unknown operator: $operator");
        }

        return "$startBrace$startValue TO $endValue$endBrace";
    }
protected function getQueryRange ( $ operator , $ start , $ end ) { $ start = $ this -> prepareValue ( $ start ) ; $ end = $ this -> prepareValue ( $ end ) ; $ startBrace = '[' ; $ startValue = '*' ; $ endValue = '*' ; $ endBrace = ']' ; switch ( $ operator ) { case Operator :: GT : $ startBrace = '{' ; $ endBrace = '}' ; // Intentionally omitted break case Operator :: GTE : $ startValue = $ start ; break ; case Operator :: LT : $ startBrace = '{' ; $ endBrace = '}' ; // Intentionally omitted break case Operator :: LTE : $ endValue = $ end ; break ; case Operator :: BETWEEN : $ startValue = $ start ; $ endValue = $ end ; break ; default : throw new \ RuntimeException ( "Unknown operator: $operator" ) ; } return "$startBrace$startValue TO $endValue$endBrace" ; }
Get Elasticsearch range query.

Start and end are optional, depending on the respective operator. Pass
null in this case. The operator may be one of:

- case Operator::GT:
- case Operator::GTE:
- case Operator::LT:
- case Operator::LTE:
- case Operator::BETWEEN:

@throws \RuntimeException If operator is no recognized

@param mixed $operator
@param mixed $start
@param mixed $end

@return string
Get Elasticsearch range query .