如何在Elasticsearch中获取嵌套类型的数组?

时间:2015-08-26 14:25:16

标签: java arrays scala elasticsearch scala-2.11

我有以下文件

{
  "_index" : "Testdb",
  "_type" : "artWork",
  "_id" : "0",
  "_version" : 1,
  "found" : true,
  "_source":{"uuid":0
,"StatusHistoryList":[
     {"ArtWorkDate":"2015-08-26T19:05:55.137+05:00",
      "ArtworkStatus":"ACTIVE"
     }
                      ]
}
}

我想获取数组的值,但我不知道该怎么做请帮我这里是我的代码

val get=client.prepareGet("Testdb","artWork",Id.toString())
        .setOperationThreaded(false)
        .setFields("uuid","StatusHistoryList","_source")
        .execute()
        .actionGet()
//as i know howto fetch a single element from a document as i get uuid value accurately  
       var uuid=get.getField("uuid").getValue.toString().toInt
//how to get `StatusHistoryList` array elements ?
       var a=get.getField("StatusHistoryList").getValues.toArray()//as i am not sure is this correct or not 

请帮帮我

0 个答案:

没有答案