Skip to content

Instantly share code, notes, and snippets.

@Hates
Created July 31, 2014 11:34
Show Gist options
  • Save Hates/c646120ae1b0494167e0 to your computer and use it in GitHub Desktop.
Save Hates/c646120ae1b0494167e0 to your computer and use it in GitHub Desktop.
GET media-development/media/_mapping
{
"media-development": {
"mappings": {
"media": {
"properties": {
"authors": {
"type": "string",
"fields": {
"raw": {
"type": "string",
"analyzer": "keyword_lowercase"
}
}
},
"language": {
"type": "string",
"analyzer": "keyword_lowercase"
},
"publication_date": {
"type": "date",
"format": "dateOptionalTime"
},
"publisher": {
"type": "string"
},
"purchases": {
"type": "nested",
"properties": {
"client": {
"type": "string"
},
"purchase_date": {
"type": "date",
"format": "dateOptionalTime"
}
}
},
"scripture": {
"type": "boolean"
},
"subject": {
"type": "string",
"fields": {
"raw": {
"type": "string",
"analyzer": "keyword_lowercase"
}
}
},
"title": {
"type": "string",
"fields": {
"raw": {
"type": "string",
"analyzer": "keyword_lowercase"
}
}
}
}
}
}
}
}
GET media-development/media/_search
{
"fields" : ["authors"],
"size": 1,
"query": {
"match": {
"authors.raw": "Joseph Fielding Smith"
}
}
}
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 11,
"max_score": 10.294406,
"hits": [
{
"_index": "media-development",
"_type": "media",
"_id": "53d8e5ca83368502ac003add",
"_score": 10.294406,
"fields": {
"authors": [
"Joseph Fielding Smith"
]
}
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment