Created
January 24, 2012 17:38
-
-
Save focampo/1671402 to your computer and use it in GitHub Desktop.
ES - Adding new custom analyzer
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
#Creating index with a custom analyzer | |
curl -XPUT "http://localhost:9200/myindex/" -d '{ | |
"settings" : { | |
"analysis": { | |
"analyzer": { | |
"my_analyzer": { | |
"type": "custom", | |
"tokenizer" : "standard", | |
"filter" : ["standard", "lowercase", "asciifolding"] | |
} | |
} | |
} | |
} | |
}' | |
#Testing 'my_analyzer' analyzer | |
curl -XGET "http://localhost:9200/myindex/_analyze?format=text&analyzer=my_analyzer" -d 'Analyze this please' | |
#Closing index | |
curl -XPOST 'http://localhost:9200/myindex/_close' | |
#Adding new analyzer | |
curl -XPUT http://localhost:9200/myindex/_settings -d '{ | |
"analysis": { | |
"analyzer": { | |
"my_other_analyzer": { | |
"type": "custom", | |
"tokenizer" : "standard", | |
"filter" : ["lowercase", "word_delimiter"] | |
} | |
} | |
} | |
}' | |
#Reopening index | |
curl -XPOST http://localhost:9200/myindex/_open | |
#Testing 'my_other_analyzer' analyzer | |
curl -XGET "http://localhost:9200/myindex/_analyze?format=text&analyzer=my_other_analyzer" -d 'AnalyzeThisPlease' | |
Thanks Kimchy. Fixed and working.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The update settings should be this: