Skip to content

Instantly share code, notes, and snippets.

@viniciusccarvalho
Created July 31, 2012 15:40
Show Gist options
  • Save viniciusccarvalho/3217914 to your computer and use it in GitHub Desktop.
Save viniciusccarvalho/3217914 to your computer and use it in GitHub Desktop.
ES corrupt index example
Create index:
{
"analysis" : {
"analyzer" : {
"partial_name" : {
"type" : "custom",
"tokenizer" : "whitespace",
"filter" : ["lowercase","stop","asciifolding","custom_ngram"]
},
"standard_name" : {
"type":"custom",
"tokenizer" : "whitespace",
"filter" : ["lowercase", "stop", "asciifolding", "my_snow"]
}
},
"filter" : {
"custom_ngram" : {
"type" : "edgeNGram",
"min_gram" : 3,
"max_gram" : 20
},
"my_snow" : {
"type" : "snowball",
"language" : "English"
}
}
}
}
mapping:
{
"album" : {
"properties" : {
"album_id" : {"type" : "integer", "store":"no", "include_in_all" : "false"} ,
"artist_id" : {"type" : "integer", "store":"no", "include_in_all" : "false"} ,
"title" : {
"type" : "multi_field",
"fields": {
"name" :{"analyzer": "standard_name", "type":"string", "store":"false", "include_in_all":"true"},
"ngram" : {"search_analyzer": "standard_name","index_analyzer": "partial_name","type": "string", "include_in_all":"false"}
}
},
"artist" : {
"type" : "multi_field",
"fields": {
"name" :{"analyzer": "standard_name", "type":"string", "store":"false", "include_in_all":"true"},
"ngram" : {"search_analyzer": "standard_name","index_analyzer": "partial_name","type": "string", "include_in_all":"false"}
}
},
"genre" : {"type" : "string", "index" : "not_analyzed", "store" : "no", "include_in_all" : "false"} ,
"label" : {"type" : "string", "store" : "no", "include_in_all" : "false", index:"not_analyzed" } ,
"downloads" : {"type" : "integer", "store":"no", "include_in_all" : "false"} ,
"rating" : {"type" : "float", "store":"no", "include_in_all" : "false", index:"not_analyzed"} ,
"alpha" : {"type" : "integer", "store" : "no", "include_in_all" : "false", "index":"not_analyzed"},
"single" : {"type" : "boolean", "store" : "no", "include_in_all" : "false", "index" : "not_analyzed"},
"live" : {"type" : "boolean", "store" : "no", "include_in_all" : "false", "index" : "not_analyzed"},
"compilation" : {"type" : "boolean", "store" : "no", "include_in_all" : "false", "index" : "not_analyzed"},
"editors_pick" : {"type" : "boolean", "store" : "no", "include_in_all" : "false", "index" : "not_analyzed"}
}
}
}
sample document:
{
"album": {
"album_id":2,
"artist_id":1,
"title":"The number of the beast",
"artist":"Iron Maiden",
"genre":"Metal",
"label":"EMI",
"downloads":2500,
"rating":0.88,
"alpha":76,
"single":"false",
"editors_pick":"false",
"live":"false",
"compilation":"false"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment