ES 5 mget


#1

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?


(Adrien Grand) #2

Which version of Elasticsearch is this?


#3

The version is 5.2.

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


(Adrien Grand) #4

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


#5

Do you have any ideas to reproduce it?

I've simply restored the snapshot.


(system) #6

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