Last active
October 24, 2015 10:04
-
-
Save up1/56528c139462a8ffe2af to your computer and use it in GitHub Desktop.
Elasticsearch :: special character
This file contains 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
curl -XGET 'localhost:9200/twitter/_analyze?pretty=1&field=message' -d "Hello #Elasticsearch with @somkiat" | |
{ | |
"tokens" : [ { | |
"token" : "hello", | |
"start_offset" : 0, | |
"end_offset" : 5, | |
"type" : "word", | |
"position" : 1 | |
}, { | |
"token" : "#elasticsearch", | |
"start_offset" : 6, | |
"end_offset" : 20, | |
"type" : "word", | |
"position" : 2 | |
}, { | |
"token" : "with", | |
"start_offset" : 22, | |
"end_offset" : 26, | |
"type" : "word", | |
"position" : 3 | |
}, { | |
"token" : "@somkiat", | |
"start_offset" : 27, | |
"end_offset" : 35, | |
"type" : "word", | |
"position" : 4 | |
} ] | |
} |
This file contains 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
curl -XGET 'localhost:9200/_analyze?pretty=1' -d "Hello #Elasticsearch with @somkiat" | |
{ | |
"tokens" : [ { | |
"token" : "hello", | |
"start_offset" : 0, | |
"end_offset" : 5, | |
"type" : "<ALPHANUM>", | |
"position" : 1 | |
}, { | |
"token" : "elasticsearch", | |
"start_offset" : 7, | |
"end_offset" : 20, | |
"type" : "<ALPHANUM>", | |
"position" : 2 | |
}, { | |
"token" : "with", | |
"start_offset" : 22, | |
"end_offset" : 26, | |
"type" : "<ALPHANUM>", | |
"position" : 3 | |
}, { | |
"token" : "somkiat", | |
"start_offset" : 28, | |
"end_offset" : 35, | |
"type" : "<ALPHANUM>", | |
"position" : 4 | |
} ] | |
} |
This file contains 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
curl -XPUT 'http://localhost:9200/twitter' -d '{ | |
"settings" : { | |
"index" : { | |
"number_of_shards" : 1, | |
"number_of_replicas" : 1 | |
}, | |
"analysis" : { | |
"filter" : { | |
"tweet_filter" : { | |
"type" : "word_delimiter", | |
"type_table": ["# => ALPHA", "@ => ALPHA"] | |
} | |
}, | |
"analyzer" : { | |
"tweet_analyzer" : { | |
"type" : "custom", | |
"tokenizer" : "whitespace", | |
"filter" : ["lowercase", "tweet_filter"] | |
} | |
} | |
} | |
}, | |
"mappings" : { | |
"tweet" : { | |
"properties" : { | |
"message" : { | |
"type" : "string", | |
"analyzer" : "tweet_analyzer" | |
} | |
} | |
} | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment