This project starts 3 node elasticsearch cluster with Nobel laureates dataset.
{
"year": "2019",
"category": "chemistry",
"laureates": [
{
"id": "976",
"firstname": "John",
"surname": "Goodenough",
"motivation": "for the development of lithium-ion batteries",
"share": "3"
},
...
]
}
docker-compose up
NOTE By default, a fresh new cluster created
To run this project you should install:
- docker
- docker-compose
{
"mappings": {
"properties": {
"year": { "type": "integer"},
"category": {"type": "text"},
"laureates": {
"type": "nested",
"properties" : {
"id": {"type": "long"},
"firstname": {"type": "text"},
"surname": {"type": "text"},
"motivation": {"type": "text"},
"share": {"type": "text"}
}
}
}
}
}
Search for the two Nobel laureates John Goodenough and M. Stanley Whittingham
curl --location --request GET 'http://localhost:9200/nobel/_search' \
--header 'Content-Type: application/json' \
--data-raw '{
"query": {
"bool": {
"must": [
{
"nested": {
"path": "laureates",
"query": {
"bool": {
"must": [
{
"match": {
"laureates.firstname": "John"
}
},
{
"match": {
"laureates.surname": "Goodenough"
}
}
]
}
}
}
},
{
"nested": {
"path": "laureates",
"query": {
"bool": {
"must": [
{
"match": {
"laureates.firstname": "M. Stanley"
}
},
{
"match": {
"laureates.surname": "Whittingham"
}
}
]
}
}
}
}
]
}
}
}'