Skip to content

Instantly share code, notes, and snippets.

@johtani
Last active January 2, 2016 18:49
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 johtani/8346404 to your computer and use it in GitHub Desktop.
Save johtani/8346404 to your computer and use it in GitHub Desktop.
elasticsearch-ML : "Searching indexed fields without analysing" sample
curl -XPUT "http://localhost:9200/wildcard_sample"
curl -XPOST "http://localhost:9200/wildcard_sample/users/_mapping" -d'
{
"users": {
"properties": {
"User_Name": {
"type": "multi_field",
"fields": {
"User_Name": {
"type": "string",
"omit_norms": true
},
"raw": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"index_options": "docs",
"include_in_all": false,
"ignore_above": 256
}
}
}
}
}
}'
curl -XPOST "http://localhost:9200/wildcard_sample/users/1" -d'
{
"User_Name" : "bob.smith-jones"
}'
curl -XPOST "http://localhost:9200/wildcard_sample/users/_search" -d'
{
"query": {
"query_string": {
"query": "User_Name.raw:bob.smith-j*"
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment