Skip to content

Instantly share code, notes, and snippets.

@imotov
Created March 12, 2014 03:28
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 imotov/9500276 to your computer and use it in GitHub Desktop.
Save imotov/9500276 to your computer and use it in GitHub Desktop.
curl -XDELETE "localhost:9200/test-idx?pretty"
curl -XPUT "localhost:9200/test-idx?pretty" -d '{
"settings": {
"index": {
"analysis": {
"analyzer": {
"dw_docid": {
"type": "custom",
"tokenizer": "dw_docid_tokenizer",
"filter": ["dw_docid_filter"]
}
},
"filter": {
"dw_docid_filter": {
"type": "word_delimiter",
"generate_word_parts": false,
"generate_number_parts": true,
"catenate_words": false,
"catenate_numbers": true,
"catenate_all": false,
"split_on_case_change": false,
"preserve_original": false,
"stem_english_possessive": false
}
},
"tokenizer": {
"dw_docid_tokenizer": {
"type": "path_hierarchy",
"delimiter": "-"
}
}
}
}
},
"mappings": {
"test-type" : {
"dynamic_templates" : [
{
"template_1" : {
"match" : "*",
"mapping" : {
"type" : "multi_field",
"fields" : {
"{name}" : {
"type": "string",
"index" : "not_analyzed"
},
"text" : {
"type": "string",
"index" : "analyzed",
"analyzer": "dw_docid"
}
}
}
}
}
]
}
}
}'
curl -XPUT "localhost:9200/test-idx/test-type/1?pretty" -d '{
"myString": "1111-2222"
}'
curl -XPOST "localhost:9200/test-idx/_refresh?pretty"
curl "localhost:9200/test-idx/test-type/_search?pretty&default_operator=AND&q=myString.text:2222-1111"
curl "localhost:9200/test-idx/_analyze?pretty&field=myString.text" -d '1111-2222'
curl "localhost:9200/test-idx/_validate/query?pretty&explain&default_operator=AND&q=myString.text:2222-1111"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment