0
我试图建立使用elasticsearch一个建议者提取结果,我构建的查询类和执行后,我得到这个Suggest
结果,我无法从中提取实际文本。我现在正在scala控制台上尝试这个。如何从org.elasticsearch.search.suggest.Suggest对象斯卡拉
scala> result
res75: org.elasticsearch.search.suggest.Suggest =
{
"first_name" : [ {
"text" : "hari",
"offset" : 0,
"length" : 4,
"options" : [ {
"text" : "HARIA",
"score" : 1.0
}, {
"text" : "HARID",
"score" : 1.0
}, {
"text" : "HARIDAS",
"score" : 1.0
}, {
"text" : "HARIDASN",
"score" : 1.0
}, {
"text" : "HARIDASNSS",
"score" : 1.0
}]
} ]
}
scala> result.getSuggestion()
<console>:25: error: not enough arguments for method getSuggestion: (x$1: String)T.
Unspecified value parameter x$1.
result.getSuggestion()
如何从上述结果中提取text
。我可以看到result.getSuggestion()
是,这将给这个方法,但我必须通过一些地图或其它功能参数传递给它。我不知道如何做到这一点..你能帮忙吗?
谢谢。
https://gist.github.com/evanwong/6511366 - 这是有点儿节省我的时间。如果我完成它将发布结果。 – 2014-11-23 07:42:28