Skip to content

Instantly share code, notes, and snippets.

@maruf89
Created June 18, 2014 02:37
Show Gist options
  • Save maruf89/67110409d7a063dd60e0 to your computer and use it in GitHub Desktop.
Save maruf89/67110409d7a063dd60e0 to your computer and use it in GitHub Desktop.
Elasticsearch Index Updates
// close the index with `POST` (using `PUT` will throw error)
curl -XPOST localhost:9200/users/_close
// Update with the analysis with a `PUT` (using `POST` will throw error)
curl -XPUT localhost:9200/users/_settings -d '{
"analyzer": {
"ngram_languages": {
"tokenizer": "ngram_languages_tokenizer"
}
},
"tokenizer": {
"ngram_languages_tokenizer": {
"type": "nGram",
"min_gram": "3",
"max_gram": "6",
"token_chars": [
"letter",
"punctuation"
]
}
}
}
}'
// Reopen
curl -XPOST localhost:9200/users/_open
// View Index Config
curl -XGET 'http://localhost:9200/_cluster/state?pretty&filter_nodes=true&filter_routing_table=true&filter_indices=users'
// View analyzed text
curl 'localhost:9200/users/_analyze?pretty=true&analyzer=ngram_languages' -d 'Lithuanian'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment