Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dspangen
Created December 1, 2012 21:52
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 dspangen/4185356 to your computer and use it in GitHub Desktop.
Save dspangen/4185356 to your computer and use it in GitHub Desktop.
ES mapping for docs
{
"document" : {
"dynamic": "strict",
"properties" : {
"name" : { "type" : "string" },
"external_id" : {
"type" : "string",
"index" : "not_analyzed"
},
"internal_id" : { "type" : "long" },
"properties" : {
"type" : "nested",
"path" : "full",
"include_in_root": true,
"properties" : {
"name" : {
"type" : "multi_field",
"fields" : {
"name" : { "type" : "string", "index" : "analyzed" },
"assignment" : { "type" : "string", "index" : "not_analyzed" }
}
},
"value" : {
"type" : "multi_field",
"fields" : {
"value" : { "type" : "string", "index" : "analyzed" },
"assignment" : { "type" : "string", "index" : "not_analyzed" }
}
}
}
}
}
}
}
"query": {
"filtered": {
"query": {
"match_all": {
}
},
"filter": {
"and": [
{
"or": [
{
"nested": {
"path": "properties",
"query": {
"filtered": {
"query": {
"match_all": {
}
},
"filter": {
"and": [
{
"term": {
"properties.name.assignment": "Manufacturer"
}
},
{
"match_phrase_prefix": {
"properties.value": "Son"
}
}
]
}
}
}
}
}
]
}
]
}
}
},
"facets": {
"fields": {
"terms": {
"field": "properties.name.assignment",
"size": 20
},
"facet_filter": {
"and": [
{
"or": [
{
"and": [
{
"term": {
"properties.name.assignment": "Manufacturer"
}
},
{
"match_phrase_prefix": {
"properties.value": "Son"
}
}
]
}
]
}
]
}
},
"values": {
"terms": {
"field": "properties.value.assignment",
"size": 20
},
"facet_filter": {
"and": [
{
"or": [
{
"and": [
{
"term": {
"properties.name.assignment": "Manufacturer"
}
},
{
"match_phrase_prefix": {
"properties.value": "Son"
}
}
]
}
]
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment