Plugin development - NodeClient usage

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.

	@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:

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.

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