# Plugin development - NodeClient usage

**URL:** <https://discuss.elastic.co/t/plugin-development-nodeclient-usage/362245>\
**Category:** Elastic Search\
**Created:** [June 29, 2024, 8:34pm UTC](https://discuss.elastic.co/t/plugin-development-nodeclient-usage/362245 "2024-06-29T20:34:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![saandy](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@saandy](https://discuss.elastic.co/u/saandy)\
**Post date:** [June 29, 2024, 8:34pm UTC](https://discuss.elastic.co/t/plugin-development-nodeclient-usage/362245/1 "2024-06-29T20:34:17Z")

</div>

Hello,  
I'm developing a plugin for elasticsearch 7.17.14 where I need to get mappings for the index that could not present on the node where plugin executing. Therefor I'm using the NodeClient to get mappings.

```auto
	@Override
	protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
    ...
    String indexName = getIndexName(request);
    client.execute(GetMappingsAction.INSTANCE,
					new GetMappingsRequest().indices(indexName)).actionGet();
    ...
    }

```

It works fine but sometimes actionGet() call hangs. Or throws an exception if I am using it with timeout argument.  
However if I am using:

```auto
client.admin().indices().getMappings(
					new GetMappingsRequest().indices(indexName)).actionGet();

```

Everything works fine.

Could you please explain to me what is the difference between the first and second way. And maybe both are wrong and it is better to do it differently?

thanks in advance,  
-- Andrei.

---

<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:** [July 27, 2024, 8:34pm UTC](https://discuss.elastic.co/t/plugin-development-nodeclient-usage/362245/2 "2024-07-27T20:34:31Z")

</div>

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