If I put a document like this:
$ curl -XPOST "http://localhost:9200/test/test/" -d '
{
"books": {
"id1": {
"name": "Hello World!"
},
"id2": {
"name": "Hitchhiker Guide To The Galaxy"
}
}
}'
Then it creates a mapping like this:
$ curl -XGET "http://localhost:9200/test/test/_mapping"
{
"test":{
"mappings":{
"test":{
"properties":{
"books":{
"properties":{
"id1":{
"properties":{
"name":{
"type":"string"
}
}
},
"id2":{
"properties":{
"name":{
"type":"string"
}
}
}
}
}
}
}
}
}
}
The properties / keys in the "books" object are dynamic and the mapping will grow endlessly. How can I make ES not look at the keys for "books" and make it understand that each value in "books" is of the same type? E.g. the mapping should not contain a new entry for each book id.
You can store only one document at a time, unless you use bulk upload. A single document could look like this:
Or: