Created
September 22, 2011 11:34
-
-
Save kimchy/1234581 to your computer and use it in GitHub Desktop.
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
# Have an index created with "no_stopwords" analyzer | |
curl -XPUT 'http://localhost:9200/my_twitter1/' -d ' | |
{ | |
"settings": { | |
"number_of_shards": 1, | |
"number_of_replicas": 0, | |
"analysis" : { | |
"analyzer" : { | |
"no_stopwords" : { | |
"type" : "standard", | |
"stopwords" : "_none_" | |
} | |
} | |
} | |
}, | |
"mappings": { | |
"tweet" : { | |
"_all" : {"type" : "string", "null_value" : "na", "index" : "analyzed", "analyzer" : "no_stopwords"}, | |
"properties" : { | |
"user" : {"type" : "string", "index" : "not_analyzed"}, | |
"message" : {"type" : "string", "null_value" : "na", "index" : "analyzed", "analyzer" : "no_stopwords"}, | |
"postDate" : {"type" : "date"} | |
} | |
} | |
} | |
}' | |
# But that can be annoying to set on each field, i.e. we want the no_stopword analyzer to be the default (and then we don't have to specify it in the mappings): | |
curl -XPUT 'http://localhost:9200/my_twitter1/' -d ' | |
{ | |
"settings": { | |
"number_of_shards": 1, | |
"number_of_replicas": 0, | |
"analysis" : { | |
"analyzer" : { | |
"default" : { | |
"type" : "standard", | |
"stopwords" : "_none_" | |
} | |
} | |
} | |
}, | |
"mappings": { | |
"tweet" : { | |
"_all" : {"type" : "string", "null_value" : "na", "index" : "analyzed"}, | |
"properties" : { | |
"user" : {"type" : "string", "index" : "not_analyzed"}, | |
"message" : {"type" : "string", "null_value" : "na", "index" : "analyzed"}, | |
"postDate" : {"type" : "date"} | |
} | |
} | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment