---
title: EntitiesByGuidsQuery
source: https://docs.newrelic.com/docs/new-relic-solutions/build-nr-ui/sdk-component/query-and-storage/EntitiesByGuidsQuery
---

Query a list of entities by their GUIDs.

You can fetch a maximum of 25 entities in one query.

### Usage

```jsx
import { EntitiesByGuidsQuery } from 'nr1'
```

### Examples

#### Declarative Query

```jsx
<EntitiesByGuidsQuery
  entityGuids={[
    "MTIzNDU2fEZPT3xCQVJ8OTg3NjU0MzIx",
    "MTIzNDU2fEZPT3xCQVJ8OTg3NjU0MzUz",
  ]}
>
  {({ loading, error, data }) => {
    if (loading) {
      return <Spinner />;
    }

    if (error) {
      return "Error!";
    }

    return (
      <List items={data.entities} rowHeight={20}>
        {({ item }) => <ListItem key={item.guid}>{item.name}</ListItem>}
      </List>
    );
  }}
</EntitiesByGuidsQuery>
```

#### Fetch with sorting criteria

```jsx
<EntitiesByGuidsQuery
  entityGuids={[
    "MTIzNDU2fEZPT3xCQVJ8OTg3NjU0MzIx",
    "MTIzNDU2fEZPT3xCQVJ8OTg3NjU0MzUz",
  ]}
  sortType={[EntitiesByGuidsQuery.SORT_TYPE.ALERT_SEVERITY]}
>
  {({ loading, error, data }) => {
    if (loading) {
      return <Spinner />;
    }

    if (error) {
      return "Error!";
    }

    return (
      <List items={data.entities} rowHeight={20}>
        {({ item }) => <ListItem key={item.guid}>{item.name}</ListItem>}
      </List>
    );
  }}
</EntitiesByGuidsQuery>
```

#### Imperative query

```js
EntitiesByGuidsQuery.query({
  entityGuids: [
    'MTIzNDU2fEZPT3xCQVJ8OTg3NjU0MzIx',
    'MTIzNDU2fEZPT3xCQVJ8OTg3NjU0MzUz',
  ],
}).then(({ data }) => console.log(data));
```

### Props

| `children` function              | Render prop function as a child.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `entityFragmentExtension` object | GraphQL fragment document parsed into an AST by `graphql-tag`.The Query components return the most commonly used fields available on an entity. You can use this prop when you want to request additional fields for the entities returned by your query.The fragment should be named `EntityFragmentExtension` and apply to the `EntityOutline` type. ````js const entityFragmentExtension = ngql`   fragment EntityFragmentExtension on EntityOutline {     indexedAt     guid   } `; ```  ````                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `entityGuids` REQUIREDstring\[]  | GUID of the entities to query.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `fetchPolicyType` enum           | Allows you to specify how you want your query to interact with the cached data. - `CACHE_AND_NETWORK`: The query returns your initial data from the cache if available. However, regardless of whether or not the full data is in your cache, the query always makes a request using your network interface and returns the updated data. This option is not available when using the static `query()` method of the component. - `CACHE_FIRST`: The query makes a request using your network interface **only** if the data for your query is not already in the cache. - `CACHE_ONLY`: The query **never** makes a request using your network interface. Instead it returns the data available in the cache. If the data for your query does not exist in the cache, then an error is thrown. - `NETWORK_ONLY`: The query **never** returns your initial data from the cache. Instead it **always** makes a request using your network interface. - `NO_CACHE`: The query **never** returns your initial data from the cache. Instead it **always** makes a request using your network interface. Unlike the `NETWORK_ONLY` policy, it does not write any data to the cache after the query completes. EntitiesByGuidsQuery.FETCH_POLICY_TYPE.CACHE_AND_NETWORK, EntitiesByGuidsQuery.FETCH_POLICY_TYPE.CACHE_FIRST, EntitiesByGuidsQuery.FETCH_POLICY_TYPE.CACHE_ONLY, EntitiesByGuidsQuery.FETCH_POLICY_TYPE.NETWORK_ONLY, EntitiesByGuidsQuery.FETCH_POLICY_TYPE.NO_CACHE, |
| `includeSummaryMetrics` boolean  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `includeTags` boolean            | If `true`, the returned entities include their tags.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `pollInterval` number            | Interval in milliseconds to poll for new data. Set to zero to avoid any kind of regular polling.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `skip` boolean                   | When set to `true`, the query will be skipped entirely from rendering.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `sortBy` DEPRECATED              | > #### ⚠️ DUE NOVEMBER 1ST, 2023 > > The sortBy is deprecated, use sortType instead                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `sortType` enum\[]               | Array of criteras used to sort the entity search results. EntitiesByGuidsQuery.SORT_TYPE.ALERT_SEVERITY, EntitiesByGuidsQuery.SORT_TYPE.DOMAIN, EntitiesByGuidsQuery.SORT_TYPE.MOST_RELEVANT, EntitiesByGuidsQuery.SORT_TYPE.NAME, EntitiesByGuidsQuery.SORT_TYPE.REPORTING, EntitiesByGuidsQuery.SORT_TYPE.TYPE,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

### Methods

### `EntitiesByGuidsQuery.query`

### Type definitions
