Open marcellalves opened 4 years ago
I should update the documentation as many people have problems with building plugins. If using the docker image the best way to match the plugin to the docker image is to checkout a matching release tag, e.g. 6.4.1, and use this script.
Thanks for your help. The plugin is running now, but the mapping was not created. Any ideas? The middleware code is as follows:
package main
import (
"log"
"os"
"github.com/rwynn/monstache/monstachemap"
)
func Process(input *monstachemap.ProcessPluginInput) (err error) {
var infoLog = log.New(os.Stdout, "INFO ", log.Flags())
infoLog.Printf("Iniciou a execução do mérodo Process")
mapping := `{
"properties" : {
"Event" : { "type" : "string" },
"suggest" : { "type" : "completion",
"analyzer" : "simple",
"search_analyzer" : "simple",
"payloads" : true
}
}
}`
input.ElasticClient.PutMapping().Index("useractivitydb.useractivities").BodyString(mapping)
return
}
To write a middleware that maps a property for suggestions (completion type), I've followed the steps described at monstache website:
The first two steps I ran in a Windows machine. I'm using the following Docker image: rwynn/monstache:6.4.1, so I checked out the v6.4.1 tag inside a local branch.
Next I've spin up a docker container with Go to build the plugin:
docker container run -it --rm -v %cd%:/app/monstache golang
Inside the container, I ran the following commands:
The .so file was created successfully, but when I tested it with monstache, I've received this error message:
I don't know why it's not working, since I've followed the steps described in the documentation.
That's my custom plugin code: