Last active
December 26, 2015 12:19
-
-
Save darklow/7150542 to your computer and use it in GitHub Desktop.
ElasticSearch simple analyzer test
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 | |
# ======================================== | |
# 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