July 2015
Intermediate to advanced
192 pages
3h 38m
English
Using the nested datatype is one alternative for the inner objects and it solves the issue with the flattening of documents in Elasticsearch. Let's see how we can use the nested datatype. Let's consider the following example:
curl -XPOST localhost:9200/authors/author/1 -d'{
"name": "Multi G. Enre",
"books": [
{
"name": "Guns and lasers",
"genre": "scifi",
"publisher": "orbit"
},
{
"name": "Dead in the night",
"genre": "thriller",
"publisher": "penguin"
}
]
}'
curl -XPOST localhost:9200/authors/author/2 -d'{
"name": "Alastair Reynolds",
"books": [
{
"name": "Revelation Space",
"genre": "scifi",
"publisher": "penguin"
}
]
}'If you examine carefully, you would ideally notice no difference as to how the document looks like ...
Read now
Unlock full access