Skip to content

Instantly share code, notes, and snippets.

@spinscale
Created October 12, 2017 07:29
Show Gist options
  • Save spinscale/96275fc5821acafff38d822ba0ac69f2 to your computer and use it in GitHub Desktop.
Save spinscale/96275fc5821acafff38d822ba0ac69f2 to your computer and use it in GitHub Desktop.
Training Copenhagen: Stored fields example
DELETE sample
PUT sample
{
"mappings": {
"foo" : {
"_source": { "enabled": false },
"properties": {
"my_field" : {
"type": "text",
"store": true
},
"my_other_field" : {
"type": "text",
"store": true
}
}
}
}
}
PUT sample/foo/1
{
"my_field" : "Some awesome content"
}
GET sample/_search
{
"query": {
"match": {
"my_field": "content"
}
}
}
GET sample/foo/1?stored_fields=my_field
GET sample/_search
{
"stored_fields": [ "my_field" ],
"query": {
"match": {
"my_field": "content"
}
}
}
PUT sample/foo/1
{
"my_field" : "Some awesome content",
"my_other_field" : "Other awesome content"
}
GET sample/_search
{
"stored_fields": [ "*" ],
"query": {
"match": {
"my_field": "content"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment