public function findByIds(array $ids)
    {
        $args = [];
        $manager = $this->getManager();
        $args['body']['docs'] = [];
        $args['index'] = $manager->getIndexName();
        $args['type'] = $this->getType();

        foreach ($ids as $id) {
            $args['body']['docs'][] = [
                '_id' => $id
            ];
        }

        $mgetResponse = $manager->getClient()->mget($args);

        $return = [
            'hits' => [
                'hits' => [],
                'total' => 0,
            ]
        ];

        foreach ($mgetResponse['docs'] as $item) {
            if ($item['found']) {
                $return['hits']['hits'][] = $item;
            }
        }

        $return['hits']['total'] = count($return['hits']['hits']);

        return new DocumentIterator($return, $manager);
    }
public function findByIds(array $ids)
    {
        $args = [];
        $manager = $this->getManager();
        $args['body']['docs'] = [];
        $args['index'] = $manager->getIndexName();
        $args['type'] = $this->getType();

        foreach ($ids as $id) {
            $args['body']['docs'][] = [
                '_id' => $id
            ];
        }

        $mgetResponse = $manager->getClient()->mget($args);

        $return = [
            'hits' => [
                'hits' => [],
                'total' => 0,
            ]
        ];

        foreach ($mgetResponse['docs'] as $item) {
            if ($item['found']) {
                $return['hits']['hits'][] = $item;
            }
        }

        $return['hits']['total'] = count($return['hits']['hits']);

        return new DocumentIterator($return, $manager);
    }
public function findByIds ( array $ ids ) { $ args = [ ] ; $ manager = $ this -> getManager ( ) ; $ args [ 'body' ] [ 'docs' ] = [ ] ; $ args [ 'index' ] = $ manager -> getIndexName ( ) ; $ args [ 'type' ] = $ this -> getType ( ) ; foreach ( $ ids as $ id ) { $ args [ 'body' ] [ 'docs' ] [ ] = [ '_id' => $ id ] ; } $ mgetResponse = $ manager -> getClient ( ) -> mget ( $ args ) ; $ return = [ 'hits' => [ 'hits' => [ ] , 'total' => 0 , ] ] ; foreach ( $ mgetResponse [ 'docs' ] as $ item ) { if ( $ item [ 'found' ] ) { $ return [ 'hits' ] [ 'hits' ] [ ] = $ item ; } } $ return [ 'hits' ] [ 'total' ] = count ( $ return [ 'hits' ] [ 'hits' ] ) ; return new DocumentIterator ( $ return , $ manager ) ; }
Returns documents by a set of ids

@param array $ids

@return DocumentIterator The objects.
Returns documents by a set of ids