是否有可能通过elasticsearch grails插件上传和索引文件?
我的弹性搜索服务器中安装了https://github.com/elastic/elasticsearch-mapper-attachments插件。
Elasticsearch grails文档http://noamt.github.io/elasticsearch-grails-plugin/未提及文件映射。
域类可能看起来像这样:
class Document {
String filecontent
static searchable = {
only = ["filecontent"]
filecontent attachment:true
}
}
其中 filecontent 是base64编码文件。 实际上这有效,但我不能突出显示工作。
答案 0 :(得分:1)
目前无法使用elasticsearch-grails-plugin的标准索引映射突出显示上传的内容。
我在这里解释了一个解决方法:https://github.com/noamt/elasticsearch-grails-plugin/issues/131
答案 1 :(得分:0)
弹性搜索插件只要您使用ByteToMessageDecoder
字段创建或更新任何域实例,就可以为您执行此操作。
但是如果你想强有力地做,你可以在临时动作中注入bean static search
并在其上调用elasticSearchService
方法。
这将为您的实例编制索引。
http://noamt.github.io/elasticsearch-grails-plugin/ref/ElasticSearchService/index.html