# Elasticsearch.js client objects are all empty

**URL:** <https://discuss.elastic.co/t/elasticsearch-js-client-objects-are-all-empty/249961>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [September 25, 2020, 10:34am UTC](https://discuss.elastic.co/t/elasticsearch-js-client-objects-are-all-empty/249961 "2020-09-25T10:34:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JLobato](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@JLobato](https://discuss.elastic.co/u/JLobato)\
**Post date:** [September 25, 2020, 10:34am UTC](https://discuss.elastic.co/t/elasticsearch-js-client-objects-are-all-empty/249961/1 "2020-09-25T10:34:47Z")

</div>

Hi All,

I am trying to create a rest API with the NodeJS client so that I can retrieve data from Elastic cloud. Now when I create the client in node and return the client everything is empty.

So `client.cat` for example is empty. Which I would like to use to see all my available indexes. Is there something that I am missing? Because there is data in this environment which is used in an Kibana dashboard for example.

Is there anyone who can explain how I can make the data available?

-- code to create client --

> const { Client } = require('@elastic/elasticsearch')  
> const client = new Client({  
> node: 'My-URL..westeurope.azure.elastic-cloud.com:9243/',  
> auth: {  
> apiKey: {  
> id: 'API-ID',  
> api\_key: 'API-Key'  
> }  
> }  
> })  
> res.json(client)

-- JSON return in web browser--

```
 {
      "name": "elasticsearch-js",
      "serializer": {
    
  },
  "connectionPool": {
    "connections": [
      {
        "url": "My-URL..westeurope.azure.elastic-cloud.com",
        "id": "My-URL..westeurope.azure.elastic-cloud.com",
        "headers": {
          
        },
        "deadCount": 0,
        "resurrectTimeout": 0,
        "_openRequests": 0,
        "status": "alive",
        "roles": {
          "master": true,
          "data": true,
          "ingest": true,
          "ml": false
        }
      }
    ],
    "size": 1,
    "auth": {
      "apiKey": {
        "id": "API-ID",
        "api_key": "API-Key"
      }
    },
    "_ssl": null,
    "_agent": null,
    "dead": [
      
    ],
    "resurrectTimeout": 60000,
    "resurrectTimeoutCutoff": 5,
    "pingTimeout": 3000,
    "_sniffEnabled": false,
    "resurrectStrategy": 1
  },
  "transport": {
    "connectionPool": {
      "connections": [
        {
          "url": "My-URL..westeurope.azure.elastic-cloud.com",
          "id": "My-URL..westeurope.azure.elastic-cloud.com",
          "headers": {
            
          },
          "deadCount": 0,
          "resurrectTimeout": 0,
          "_openRequests": 0,
          "status": "alive",
          "roles": {
            "master": true,
            "data": true,
            "ingest": true,
            "ml": false
          }
        }
      ],
      "size": 1,
      "auth": {
        "apiKey": {
          "id": "API-ID",
          "api_key": "API-Key"
        }
      },
      "_ssl": null,
      "_agent": null,
      "dead": [
        
      ],
      "resurrectTimeout": 60000,
      "resurrectTimeoutCutoff": 5,
      "pingTimeout": 3000,
      "_sniffEnabled": false,
      "resurrectStrategy": 1
    },
    "serializer": {
      
    },
    "maxRetries": 3,
    "requestTimeout": 30000,
    "suggestCompression": false,
    "compression": false,
    "context": null,
    "headers": {
      "user-agent": "elasticsearch-js/7.9.0 (win32 10.0.19041-x64; Node.js v10.16.3)"
    },
    "sniffInterval": false,
    "sniffOnConnectionFault": false,
    "sniffEndpoint": "_nodes/_all/http",
    "name": "elasticsearch-js",
    "opaqueIdPrefix": null,
    "_sniffEnabled": false,
    "_nextSniff": 0,
    "_isSniffing": false
  },
  "helpers": {
    "maxRetries": 3
  },
  "async_search": {
    
  },
  "asyncSearch": {
    
  },
  "autoscaling": {
    
  },
  "cat": {
    
  },
  "ccr": {
    
  },
  "cluster": {
    
  },
  "dangling_indices": {
    
  },
  "danglingIndices": {
    
  },
  "enrich": {
    
  },
  "eql": {
    
  },
  "graph": {
    
  },
  "ilm": {
    
  },
  "indices": {
    
  },
  "ingest": {
    
  },
  "license": {
    
  },
  "migration": {
    
  },
  "ml": {
    
  },
  "monitoring": {
    
  },
  "nodes": {
    
  },
  "rollup": {
    
  },
  "searchable_snapshots": {
    
  },
  "searchableSnapshots": {
    
  },
  "security": {
    
  },
  "slm": {
    
  },
  "snapshot": {
    
  },
  "sql": {
    
  },
  "ssl": {
    
  },
  "tasks": {
    
  },
  "transform": {
    
  },
  "watcher": {
    
  },
  "xpack": {
    
  }
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 23, 2020, 10:34am UTC](https://discuss.elastic.co/t/elasticsearch-js-client-objects-are-all-empty/249961/2 "2020-10-23T10:34:50Z")

</div>

Closed on October 23, 2020, 10:34am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
