# ES 5 mget

**URL:** <https://discuss.elastic.co/t/es-5-mget/84498>\
**Category:** Elasticsearch\
**Created:** [May 4, 2017, 7:47am UTC](https://discuss.elastic.co/t/es-5-mget/84498 "2017-05-04T07:47:50Z")\
**Posts on this page:** 6\
**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:** [May 4, 2017, 7:47am UTC](https://discuss.elastic.co/t/es-5-mget/84498/1 "2017-05-04T07:47:50Z")

</div>

I'm executing this code:

```
MultiGetResponse response = this.elasticClient.prepareMultiGet()
.add(this.user.getMe().getUser(), FollowUpActivityRepository.ELASTICSEARCH_COLLECTION, ids)
.execute()
.actionGet();

```

I'm getting a response. Nevertheless, even thought the requested document by id exists, it's telling me that it's not able to get it:

```
for (MultiGetItemResponse singleResponse : response.getResponses()) {
    if (singleResponse.getResponse().isExists())
    {
        ((((1))) <<<< code never reached.
    }
}

```

I've took a look into `response.responses[0].response` and I'm getting this message:

> Error building toString out of XContent: com.fasterxml.jackson.core.JsonGenerationException: Can not start an object, expecting field name  
> at com.fasterxml.jackson.core.JsonGenerator.\_reportError(JsonGenerator.java:1676)  
> at com.fasterxml.jackson.core.json.UTF8JsonGenerator.\_verifyValueWrite(UTF8JsonGenerator.java:925)  
> at com.fasterxml.jackson.core.json.UTF8JsonGenerator.writeStartObject(UTF8JsonGenerator.java:300)  
> at org.elasticsearch.common.xcontent.json.JsonXContentGenerator.writeStartObject(JsonXContentGenerator.java:161)  
> at org.elasticsearch.common.xcontent.XContentBuilder.startObject(XContentBuilder.java:217)  
> at org.elasticsearch.index.get.GetResult.toXContent(GetResult.java:251)  
> at org.elasticsearch.action.get.GetResponse.toXContent(GetResponse.java:158)  
> at org.elasticsearch.common.Strings.toString(Strings.java:901)  
> at org.elasticsearch.action.get.GetResponse.toString(GetResponse.java:197)  
> at com.living.persistence.repository.elasticsearch.FollowUpActivityRepository.findOne(FollowUpActivityRepository.java:139)  
> at com.living.rest.services.FollowUpActivityService.categorize(FollowUpActivityService.java:185)  
> at com.living.rest.endpoints.FollowUpActivityEndpoint.categorize(FollowUpActivityEndpoint.java:102)  
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
> ....

I've tried to use `_mget` api using http straightforwardly:

```
curl -u elastic:changeme -XGET localhost:9200/index/_mget?pretty -d '
{
  "docs": [
    {
      "_type": "coll",
      "_id": "1474c1a0-2540-11e7-9271-0242ac110008"
    }
  ]
}
'

```

and I'm getting a not exists response:

```
{
  "docs" : [
    {
      "_index" : "index",
      "_type" : "coll",
      "_id" : "1474c1a0-2540-11e7-9271-0242ac110008",
      "found" : false
    }
  ]
}

```

However, I've tried to get this document using `get` api:

```
curl -u elastic:changeme -XGET localhost:9200/index/coll/1474c1a0-2540-11e7-9271-0242ac110008?pretty

```

and the response I'm getting is right:

```
{
  "_index" : "index",
  "_type" : "coll",
  "_id" : "1474c1a0-2540-11e7-9271-0242ac110008",
  "_version" : 1,
  "_routing" : "user",
  "found" : true,
  "_source" : {
    "user" : "user",
    "timestamp" : "2017-04-18T22:00:00Z",
    "startTimestamp" : "2017-04-18T22:00:00Z",
    "dueTimestamp" : null,
    "closingTimestamp" : null,
    "matter" : "Activity 16",
    "comment" : null,
    "status" : 20,
    "backlogStatus" : 20,
    "metainfos" : {
      "fbcbeacfbcbeacfbcbeacfbcbeacfbcbaeac" : [
        "Project A"
      ],
      "fceceacfcedeacfceeeacfcefeacfcfeac" : [
        "Example activity"
      ],
      "ffceacffceacffceacffceacffceac" : [
        "Marketing"
      ],
      "efeacefeacefeacefeacefeac" : [
        "2017-Q3"
      ],
      "ddfceacddfceacddfceacddfceacddfceac" : [
        "West"
      ],
      "eaaeaceabeaceaceaceadeaceaeeac" : [
        "2-Important - Not urgent"
      ],
      "eaceeaceaceeaceaceaeaceacebeaceaceceac" : [
        "4-Completed"
      ],
      "efeeeacefefeaceffeaceffeaceffeac" : [
        "Oliver"
      ]
    },
    "resources" : [],
    "notes" : null
  }
}

```

Any ideas?

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [May 9, 2017, 9:08am UTC](https://discuss.elastic.co/t/es-5-mget/84498/2 "2017-05-09T09:08:54Z")

</div>

Which version of Elasticsearch is this?

---

<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:** [May 10, 2017, 6:34am UTC](https://discuss.elastic.co/t/es-5-mget/84498/3 "2017-05-10T06:34:00Z")

</div>

The version is 5.2.

I've restored data from an snapshot made on an ES 2.4.

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [May 10, 2017, 5:24pm UTC](https://discuss.elastic.co/t/es-5-mget/84498/4 "2017-05-10T17:24:26Z")

</div>

I tried to reproduce by importing a 2.4 index into 5.2, but that did not reproduce the issue.

---

<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:** [May 11, 2017, 8:29am UTC](https://discuss.elastic.co/t/es-5-mget/84498/5 "2017-05-11T08:29:33Z")

</div>

Do you have any ideas to reproduce it?

I've simply restored the snapshot.

---

<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:** [June 8, 2017, 8:37am UTC](https://discuss.elastic.co/t/es-5-mget/84498/6 "2017-06-08T08:37:09Z")

</div>

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