Skip to content

Instantly share code, notes, and snippets.

@maximivanov
Last active August 29, 2015 13:56
Show Gist options
  • Save maximivanov/8958787 to your computer and use it in GitHub Desktop.
Save maximivanov/8958787 to your computer and use it in GitHub Desktop.
Trying to reproduce stackoverflow bug #21731881
curl -XPUT 'http://localhost:9200/test21731881/' -d '{
"settings" : {
"index" : {
"analysis" : {
"analyzer" : {
"my_ngram_analyzer" : {
"tokenizer" : "my_ngram_tokenizer"
}
},
"tokenizer" : {
"my_ngram_tokenizer" : {
"type" : "nGram",
"min_gram" : "1",
"max_gram" : "10"
}
}
}
}
},
"mappings": {
"_default_": {
"_all" : {"enabled" : true},
"properties" : {
"Description":{"type":"string","store":"yes", "index_analyzer": "my_ngram_analyzer"},
"OfficePhone":{"type":"string","store":"yes"},
"Email":{"type":"string","store":"yes", "index_analyzer": "my_ngram_analyzer"},
"FullName":{"type":"string","store":"yes", "index_analyzer": "my_ngram_analyzer"},
"ReportsTo":{"type":"string","store":"yes"},
"Department":{"type":"string","store":"yes", "index_analyzer": "my_ngram_analyzer"},
"Title":{"type":"string","store":"yes", "index_analyzer": "my_ngram_analyzer"}
}
}
}
}'
curl -XPUT 'http://localhost:9200/test21731881/map/1' -d '{
"FullName" : "andon"
}'
# matches
curl -XGET 'http://localhost:9200/_search?pretty=true' -d '{
"query": {
"match": {
"FullName": "andon"
}
}
}'
# matches too
curl -XGET 'http://localhost:9200/_search?pretty=true' -d '{
"query": {
"match": {
"_all": "andon"
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment