src/Query.php
protected function getBody()
    {

        $body = $this->body;

        if (count($this->_source)) {

            $_source = array_key_exists("_source", $body) ? $body["_source"] : [];

            $body["_source"] = array_unique(array_merge($_source, $this->_source));
        }

        if (count($this->must)) {
            $body["query"]["bool"]["must"] = $this->must;
        }

        if (count($this->must_not)) {
            $body["query"]["bool"]["must_not"] = $this->must_not;
        }

        if (count($this->filter)) {
            $body["query"]["bool"]["filter"] = $this->filter;
        }

        if (count($this->sort)) {

            $sortFields = array_key_exists("sort", $body) ? $body["sort"] : [];

            $body["sort"] = array_unique(array_merge($sortFields, $this->sort), SORT_REGULAR);

        }

        $this->body = $body;

        return $body;
    }
protected function getBody()
    {

        $body = $this->body;

        if (count($this->_source)) {

            $_source = array_key_exists("_source", $body) ? $body["_source"] : [];

            $body["_source"] = array_unique(array_merge($_source, $this->_source));
        }

        if (count($this->must)) {
            $body["query"]["bool"]["must"] = $this->must;
        }

        if (count($this->must_not)) {
            $body["query"]["bool"]["must_not"] = $this->must_not;
        }

        if (count($this->filter)) {
            $body["query"]["bool"]["filter"] = $this->filter;
        }

        if (count($this->sort)) {

            $sortFields = array_key_exists("sort", $body) ? $body["sort"] : [];

            $body["sort"] = array_unique(array_merge($sortFields, $this->sort), SORT_REGULAR);

        }

        $this->body = $body;

        return $body;
    }
protected function getBody ( ) { $ body = $ this -> body ; if ( count ( $ this -> _source ) ) { $ _source = array_key_exists ( "_source" , $ body ) ? $ body [ "_source" ] : [ ] ; $ body [ "_source" ] = array_unique ( array_merge ( $ _source , $ this -> _source ) ) ; } if ( count ( $ this -> must ) ) { $ body [ "query" ] [ "bool" ] [ "must" ] = $ this -> must ; } if ( count ( $ this -> must_not ) ) { $ body [ "query" ] [ "bool" ] [ "must_not" ] = $ this -> must_not ; } if ( count ( $ this -> filter ) ) { $ body [ "query" ] [ "bool" ] [ "filter" ] = $ this -> filter ; } if ( count ( $ this -> sort ) ) { $ sortFields = array_key_exists ( "sort" , $ body ) ? $ body [ "sort" ] : [ ] ; $ body [ "sort" ] = array_unique ( array_merge ( $ sortFields , $ this -> sort ) , SORT_REGULAR ) ; } $ this -> body = $ body ; return $ body ; }
Generate the query body
@return array
Generate the query body