public static function primaryKeysByCondition($client, $condition)
    {
        $primaryKeys = [];
        $count = $client->count($condition);
        $count = empty($count['count']) ? 10 : $count['count'];
        $condition['size'] = $count;
        $condition['_source'] = true;
        $res = $client->search($condition);
        if (false === empty($res['hits']['hits'])) {
            foreach ($res['hits']['hits'] as $doc) {
                if (false === isset($primaryKeys[$doc['_id']])) {
                    $primaryKeys[$doc['_id']] = [$doc['_type']];
                } else {
                    if (false === in_array($doc['_type'], $primaryKeys[$doc['_id']])) {
                        $primaryKeys[$doc['_id']][] = $doc['_type'];
                    }
                }
            }
        }
        return $primaryKeys;
    }