src/ElasticSearch/DSL/Builder.php
public function build() {
        $built = array();
        if ($this->from != null)
            $built['from'] = $this->from;
        if ($this->size != null)
            $built['size'] = $this->size;
        if ($this->sort && is_array($this->sort))
            $built['sort'] = $this->sort;
        if (!$this->query)
            throw new \ElasticSearch\Exception("Query must be specified");
        else
            $built['query'] = $this->query->build();
        return $built;
    }
public function build() {
        $built = array();
        if ($this->from != null)
            $built['from'] = $this->from;
        if ($this->size != null)
            $built['size'] = $this->size;
        if ($this->sort && is_array($this->sort))
            $built['sort'] = $this->sort;
        if (!$this->query)
            throw new \ElasticSearch\Exception("Query must be specified");
        else
            $built['query'] = $this->query->build();
        return $built;
    }
Build the DSL as array

@throws \ElasticSearch\Exception
@return array