# Reindex java API

**URL:** <https://discuss.elastic.co/t/reindex-java-api/45923>\
**Category:** Elasticsearch\
**Created:** [March 31, 2016, 11:02am UTC](https://discuss.elastic.co/t/reindex-java-api/45923 "2016-03-31T11:02:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kjknilsen](https://avatars.discourse-cdn.com/v4/letter/k/eada6e/32.png) [@kjknilsen](https://discuss.elastic.co/u/kjknilsen)\
**Post date:** [March 31, 2016, 11:02am UTC](https://discuss.elastic.co/t/reindex-java-api/45923/1 "2016-03-31T11:02:53Z")

</div>

Hi.  
Is the java API updated with the new reindex API?

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [March 31, 2016, 12:46pm UTC](https://discuss.elastic.co/t/reindex-java-api/45923/2 "2016-03-31T12:46:33Z")

</div>

Reindex is actually a module (plugin shipped with Elasticsearch) so it is slightly less well integrated with the java API. Calling it looks like:

```java
ReindexAction.INSTANCE.newRequestBuilder(client()).source("index1", "index2").destination("dest").get();

```

It gets less fluent when you want to be very specific:

```java
ReindexRequestBuilder builder = ReindexAction.INSTANCE.newRequestBuilder(client()).source("index1", "index2").destination("dest");
builder.source().setScroll("20m").setRouting("candycane");
builer.get();

```

---

<div class="post-metadata">

**Author:** ![kjknilsen](https://avatars.discourse-cdn.com/v4/letter/k/eada6e/32.png) [@kjknilsen](https://discuss.elastic.co/u/kjknilsen)\
**Post date:** [March 31, 2016, 2:51pm UTC](https://discuss.elastic.co/t/reindex-java-api/45923/3 "2016-03-31T14:51:51Z")

</div>

Do I have to install the module? I have installed elasticsearch 2.3 and I have a folder under modules in the install directory where the reindex jar file is.  
When I try to use it im my application I get a nullpointerexception. Can you please assist?

java.lang.NullPointerException  
at org.elasticsearch.client.transport.support.TransportProxyClient$1.doWithNode(TransportProxyClient.java:58)  
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:212)  
at org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:55)  
at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:288)  
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:359)  
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:86)  
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:56)  
at org.elasticsearch.action.ActionRequestBuilder.get(ActionRequestBuilder.java:64)  
at no.logiq.finfo.elastic.ArticleReindexTest.reindex(ArticleReindexTest.java:94)  
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
at java.lang.reflect.Method.invoke(Method.java:497)  
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)  
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)  
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)  
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)  
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)  
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)  
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)  
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)  
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)  
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)  
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)  
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)  
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)  
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)  
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119)  
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)  
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)  
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)  
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
at java.lang.reflect.Method.invoke(Method.java:497)  
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 31, 2016, 3:21pm UTC](https://discuss.elastic.co/t/reindex-java-api/45923/4 "2016-03-31T15:21:52Z")

</div>

Can you share your code for `no.logiq.finfo.elastic.ArticleReindexTest.reindex()`?

---

<div class="post-metadata">

**Author:** ![trango](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@trango](https://discuss.elastic.co/u/trango)\
**Post date:** [April 16, 2016, 11:53am UTC](https://discuss.elastic.co/t/reindex-java-api/45923/5 "2016-04-16T11:53:24Z")

</div>

Hello,

In my case, I'm able to use Reindex API as follows:

1. Start an ElasticSearch master manually,
2. Create TransportClient (adding ReindexPlugin)  
`TransportClient client = TransportClient.builder().settings(settings).addPlugin(ReindexPlugin.class).build();`
3. Use Reindex API inside my app. as Nik commented.

HTH,

Trango

---

<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 5, 2017, 10:58pm UTC](https://discuss.elastic.co/t/reindex-java-api/45923/6 "2017-07-05T22:58:50Z")

</div>


