Created
March 15, 2011 12:45
-
-
Save bdargan/870675 to your computer and use it in GitHub Desktop.
configure index and analyzers for ngram indexing
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 -XDELETE localhost:9200/twitter | |
curl -XPOST localhost:9200/twitter -d ' | |
{"index": | |
{ "number_of_shards": 1, | |
"analysis": { | |
"filter": { | |
"mynGram" : {"type": "nGram", "min_gram": 2, "max_gram": 10} | |
}, | |
"analyzer": { "a1" : { | |
"type":"custom", | |
"tokenizer": "standard", | |
"filter": ["lowercase", "mynGram"] | |
} | |
} | |
} | |
} | |
} | |
}' | |
curl -XPUT localhost:9200/twitter/_mapping -d '{ | |
"tweet" : { | |
"index_analyzer" : "a1", | |
"search_analyzer" : "standard", | |
"date_formats" : ["yyyy-MM-dd", "dd-MM-yyyy"], | |
"properties" : { | |
"user": {"type":"string", "analyzer":"standard"}, | |
"message" : {"type" : "string" } | |
} | |
}}' | |
curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{ | |
"user" : "kimchy", | |
"post_date" : "2009-11-15T14:12:12", | |
"message" : "trying out Elastic Search" | |
}' | |
curl -XGET localhost:9200/twitter/_search?q=ear | |
curl -XGET localhost:9200/twitter/_search?q=sea | |
curl -XGET localhost:9200/twitter/_mapping |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment