Created
May 15, 2014 14:36
-
-
Save tmacam/08467d4649fab00d239d to your computer and use it in GitHub Desktop.
Uppercase token filter not being correcly registerred?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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