# Multiget with several ids doesn't work \[Java API\]

**URL:** <https://discuss.elastic.co/t/multiget-with-several-ids-doesnt-work-java-api/34396>\
**Category:** Elasticsearch\
**Created:** [November 12, 2015, 10:04am UTC](https://discuss.elastic.co/t/multiget-with-several-ids-doesnt-work-java-api/34396 "2015-11-12T10:04:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![living\_jordi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/living_jordi/32/61363_2.png) [@living\_jordi](https://discuss.elastic.co/u/living_jordi)\
**Post date:** [November 12, 2015, 10:04am UTC](https://discuss.elastic.co/t/multiget-with-several-ids-doesnt-work-java-api/34396/1 "2015-11-12T10:04:37Z")

</div>

I'm trying to execute a multiget request using Java API:

```
MultiGetResponse response = this.provideMultiGetRequest()
    //username is the routing key
    .add(this.user.getMe().getUser(), FollowUpActivityRepository.ELASTICSEARCH_COLLECTION, ids)
    .execute()
    .actionGet();
	
    try {
        for (MultiGetItemResponse singleResponse : response.getResponses()) {
            if (singleResponse.getResponse().isExists())
            {
                ////////////////////////////////////////
                //when ids has more 1 id to get, it never get in this block!!!
                ////////////////////////////////////////
            }
    } catch (IOException e) {
        throw new RepositorySystemException(e);
    }

```

However, when ids Iterable contains only one element, it works...  
What am I doing wrong?

---

<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, 11:39pm UTC](https://discuss.elastic.co/t/multiget-with-several-ids-doesnt-work-java-api/34396/2 "2017-07-05T23:39:01Z")

</div>


