Skip to content

Instantly share code, notes, and snippets.

@hukl
hukl / custom_analyzer.sh
Created May 24, 2011 16:34 — forked from karmi/elastic_search_ngram_analyzer_for_urls.sh
NGram Analyzer in ElasticSearch
curl -X DELETE localhost:9200/custom_analyzer_test
curl -X PUT localhost:9200/custom_analyzer_test -d '
{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0,
"analysis" : {
"analyzer" : {
"url_analyzer" : {
int cursor = 0;
SearchResponse searchResponse = new SearchRequestBuilder(client)
.setIndices(alias)
.setSearchType(SearchType.SCAN)
.setQuery(matchAllQuery())
.setSize(10)
.setFrom(cursor)
.setScroll(TimeValue.timeValueMinutes(10))
.execute()
@hukl
hukl / gist:961310
Created May 8, 2011 11:10 — forked from clintongormley/gist:961303
Ngram example
###################
# CREATE THE INDEX:
###################
curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' -d '
{
"settings" : {
"analysis" : {
"filter" : {
"edge_ngram" : {
"side" : "front",