Created
October 12, 2017 07:29
-
-
Save spinscale/96275fc5821acafff38d822ba0ac69f2 to your computer and use it in GitHub Desktop.
Training Copenhagen: Stored fields example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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