Skip to content

Instantly share code, notes, and snippets.

@xeraa
Created October 16, 2018 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xeraa/9bef12380ead334e70b88f27f9df32b1 to your computer and use it in GitHub Desktop.
Save xeraa/9bef12380ead334e70b88f27f9df32b1 to your computer and use it in GitHub Desktop.
Retrieving a copy_to field in Elasticsearch (Kibana syntax)
DELETE my_index
PUT my_index
{
"settings": {
"number_of_shards": 1
},
"mappings": {
"_doc": {
"properties": {
"first_name": {
"type": "text",
"copy_to": "full_name"
},
"last_name": {
"type": "text",
"copy_to": "full_name"
},
"full_name": {
"type": "text",
"store": true
}
}
}
}
}
PUT my_index/_doc/1
{
"first_name": "John",
"last_name": "Smith"
}
GET my_index/_search
{
"stored_fields": [ "first_name", "full_name" ]
}
GET my_index/_doc/1/_termvectors
{
"fields" : ["last_name", "full_name"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment