Skip to content

Instantly share code, notes, and snippets.

@darklow
Last active December 26, 2015 12:19
Show Gist options
  • Save darklow/7150542 to your computer and use it in GitHub Desktop.
Save darklow/7150542 to your computer and use it in GitHub Desktop.
ElasticSearch simple analyzer test
#!/bin/bash
# ========================================
# Testing simple analyzer in ElasticSearch
# ========================================
curl -X DELETE localhost:9200/hotels
curl -X PUT localhost:9200/hotels -d '
{
"index": {
"analysis": {
"analyzer": {
"lower_only": {
"type": "custom",
"filter": [
"lower"
]
}
}
}
},
"mappings": {
"hotel": {
"properties": {
"name": {
"type": "string",
"analyzer": "simple"
}
}
}
}
}'
curl -X PUT localhost:9200/hotels/hotel/1 -d '
{
"name" : ["Hotel Sky", "Hotel Beach"]
}'
curl -X POST "http://localhost:9200/hotels/_refresh"
echo
curl -X POST "http://localhost:9200/hotels/_search?pretty=true" -d '
{
"query": {
"term": { "name": "Hotel Sky" }
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment