This is a sample Grails 4 REST Application configured to use Elasticsearch grails plugin.
- Setup Elasticsearch Docker Container as:
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e "xpack.security.enabled=false" docker.elastic.co/elasticsearch/elasticsearch:5.5.3
Please see Install Elasticsearch Documentation for other options.
-
Run application using command
./gradlew bootRun
. -
Verify that the
Post
mapping is created, run the following CURL command:
curl -X GET "localhost:9200/_mapping/post?pretty"
The output of above command should be something similar to:
{
"example.all_v0" : {
"mappings" : {
"post" : {
"_all" : {
"enabled" : false
},
"properties" : {
"body" : {
"type" : "text",
"term_vector" : "with_positions_offsets"
},
"subject" : {
"type" : "text",
"term_vector" : "with_positions_offsets"
}
}
}
}
}
}