src/ElasticSearch/DSL/RangeQuery.php
public function build() {
        $built = array();
        if ($this->fieldname) {
            $built[$this->fieldname] = array();
            foreach (array("from","to","includeLower","includeUpper", "boost") as $opt) {
                if ($this->$opt !== null)
                    $built[$this->fieldname][$opt] = $this->$opt;
            }
            if (count($built[$this->fieldname]) == 0)
                throw new \ElasticSearch\Exception("Empty RangeQuery cant be created");
        }
        return $built;
    }
public function build() {
        $built = array();
        if ($this->fieldname) {
            $built[$this->fieldname] = array();
            foreach (array("from","to","includeLower","includeUpper", "boost") as $opt) {
                if ($this->$opt !== null)
                    $built[$this->fieldname][$opt] = $this->$opt;
            }
            if (count($built[$this->fieldname]) == 0)
                throw new \ElasticSearch\Exception("Empty RangeQuery cant be created");
        }
        return $built;
    }
Build to array

@throws \ElasticSearch\Exception
@return array