Skip to content

Instantly share code, notes, and snippets.

@zumo64
Last active April 25, 2019 14:37
Show Gist options
  • Save zumo64/ce2534b7ac57320ad248d0906e866999 to your computer and use it in GitHub Desktop.
Save zumo64/ce2534b7ac57320ad248d0906e866999 to your computer and use it in GitHub Desktop.
Bands
### Bands compatible for 7.x
DELETE bands
PUT bands
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
},
"mappings": {
"dynamic": false,
"properties": {
"description": {
"type": "text"
},
"start": {
"type": "date",
"format": "dd/MM/yyyy"
},
"end": {
"type": "date",
"format": "dd/MM/yyyy"
},
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"name_autocomplete": {
"type": "completion",
"contexts": [
{
"name": "style",
"type": "category"
}
]
},
"country": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"albums": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
PUT /bands/_doc/1
{
"description": "Pink Floyd were an English rock band formed in London in 1965. They achieved international acclaim with their progressive and psychedelic music. Distinguished by their use of philosophical lyrics, sonic experimentation, extended compositions, and elaborate live shows, they are one of the most commercially successful and influential groups in popular music history.",
"start": "22/05/1968",
"end": "05/09/1984",
"name": "Pink Floyd",
"name_autocomplete": {
"input": [
"floyd",
"wall",
"waters",
"moon",
"pompei"
],
"contexts": {
"style": [
"rock",
"psychedelic"
]
}
},
"country": "UK",
"albums": [
"Atom Heart Mother"
]
}
PUT /bands/_doc/2
{
"description": "Led Zeppelin were an English rock band formed in London in 1968. The group consisted of guitarist Jimmy Page, singer Robert Plant, bassist and keyboardist John Paul Jones, and drummer John Bonham. The band's heavy, guitar-driven sound has led them to be cited as one of the progenitors of heavy metal. Their style drew from a wide variety of influences, including blues, psychedelia, and folk music.",
"start": "22/05/1969",
"end": "05/09/1979",
"name": "Led Zeppelin",
"name_autocomplete": {
"input": [
"ledzep"
],
"contexts": {
"style": [
"rock",
"hard"
]
}
},
"country": "UK",
"albums": [
"Physical Graffiti"
]
}
PUT /bands/_doc/2
{
"description": "Led Zeppelin were an English rock band formed in London in 1968. The group consisted of guitarist Jimmy Page, singer Robert Plant, bassist and keyboardist John Paul Jones, and drummer John Bonham. The band's heavy, guitar-driven sound has led them to be cited as one of the progenitors of heavy metal. Their style drew from a wide variety of influences, including blues, psychedelia, and folk music.",
"start": "22/05/1969",
"end": "05/09/1979",
"name": "Led Zeppelin",
"name_autocomplete": {
"input": [
"ledzep"
],
"contexts": {
"style": [
"rock",
"hard"
]
}
},
"country": "UK",
"albums": [
"Physical Graffiti"
]
}
PUT /bands/_doc/3
{
"description": "The Beatles were an English rock band formed in Liverpool in 1960. With members John Lennon, Paul McCartney, George Harrison and Ringo Starr, they became widely regarded as the foremost and most influential music band.",
"start": "11/03/1961",
"end": "10/04/1970",
"name": "The Beatles",
"name_autocomplete": {
"input": [
"beatles","beet","liverpool"
],
"contexts": {
"style": [
"rock",
"pop"
]
}
},
"country": "UK",
"albums": [
"White","Abbey Road"
]
}
# search using searchbox tags
POST /bands/_doc/_search
{
"query": {
"match_all": {}
},
"suggest": {
"my-suggest-1" : {
"text" : "@0",
"term" : {
"field" : "name"
}
},
"my-suggest-2" : {
"text" : "@1",
"phrase" : {
"field" : "description",
"max_errors":2,
"highlight": {
"pre_tag": "<em>",
"post_tag": "</em>"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment