Skip to content

Instantly share code, notes, and snippets.

@jprante
Created March 13, 2015 09:36
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 jprante/d7c839d47e9a9dc78311 to your computer and use it in GitHub Desktop.
Save jprante/d7c839d47e9a9dc78311 to your computer and use it in GitHub Desktop.
Char filter demo
curl -XDELETE 'localhost:9200/test'
curl -XPUT 'localhost:9200/test' -d '
{
"settings" : {
"analysis": {
"char_filter" : {
"full_text_mapping" : {
"type": "mapping",
"mappings" : [ ". => \\u0020" ]
}
},
"analyzer" : {
"full_text_analyzer" : {
"type" : "custom",
"char_filter" : "full_text_mapping",
"tokenizer" : "whitespace",
"filter" : ["lowercase"]
}
}
}
},
"mappings" : {
"bear" : {
"properties" : {
"full_text" : {
"type" : "string",
"analyzer" : "full_text_analyzer"
},
"name" : {
"type" : "string",
"index" : "not_analyzed",
"copy_to" : "full_text"
}
}
}
}
}
'
curl -XPUT 'localhost:9200/test/bear/1' -d '
{
"name": "GRIZZLY.BEAR"
}
'
curl -XGET 'localhost:9200/test/_refresh'
curl -XGET 'localhost:9200/test/_search?pretty' -d '
{
"query" : {
"match" : {
"name" : "GRIZZLY.BEAR"
}
}
}
'
curl -XGET 'localhost:9200/test/_search?pretty' -d '
{
"query" : {
"match" : {
"full_text" : "grizzly"
}
}
}
'
curl -XGET 'localhost:9200/test/_search?pretty' -d '
{
"query" : {
"match" : {
"full_text" : "bear"
}
}
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment