Skip to content

Instantly share code, notes, and snippets.

@tmacam
Created May 15, 2014 14: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 tmacam/08467d4649fab00d239d to your computer and use it in GitHub Desktop.
Save tmacam/08467d4649fab00d239d to your computer and use it in GitHub Desktop.
Uppercase token filter not being correcly registerred?
#!/bin/bash
export ELASTICSEARCH_ENDPOINT="http://localhost:9200"
# Create indexes
# DELETE indexes consecutive tests
curl -XDELETE "$ELASTICSEARCH_ENDPOINT/play"
curl -XPUT "$ELASTICSEARCH_ENDPOINT/play" -d '{
"settings": {
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "keyword",
"filter": [
"standard",
"uppercase"
]
}
}
}
},
"mappings": {
"user": {
"properties": {
"name": {
"type": "string"
},
"status": {
"type": "string",
"analyzer": "my_analyzer"
}
}
}
}
}'
# Index documents
curl -XPOST "$ELASTICSEARCH_ENDPOINT/_bulk?refresh=true" -d '
{"index":{"_index":"play","_type":"user"}}
{"name":"schmitt","status":"vaLID"}
{"index":{"_index":"play","_type":"user"}}
{"name":"schmidt","status":"invaLID"}
{"index":{"_index":"play","_type":"user"}}
{"name":"mandelbaum"}
{"index":{"_index":"play","_type":"user"}}
{"name":"robertson","status":"invaLID"}
{"index":{"_index":"play","_type":"user"}}
{"name":"ramirez","status":"invaLID"}
'
# Do searches
curl -XPOST "$ELASTICSEARCH_ENDPOINT/_search?pretty" -d '
{
"query": {
"term": {
"status": "VALID"
}
}
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment