Skip to content

Instantly share code, notes, and snippets.

@edwinv
Created June 18, 2012 11:40
Show Gist options
  • Save edwinv/2947994 to your computer and use it in GitHub Desktop.
Save edwinv/2947994 to your computer and use it in GitHub Desktop.
ElasticSearch
curl -XPOST http://localhost:9200/test/?pretty=true -d '{
"settings": {
"analysis": {
"filter": {
"edgengram_filter": {
"type": "edgeNGram",
"max_gram": 20,
"min_gram": 2,
"side": "front"
}
},
"analyzer": {
"partial_match_edge": {
"tokenizer": "standard",
"filter": ["standard", "lowercase", "asciifolding", "edgengram_filter"],
"type": "custom"
}
}
}
},
"mappings": {
"documents": {
"properties": {
"description": { "type": "string", "analyzer": "partial_match_edge" }
}
}
}
}'
curl -XPOST http://localhost:9200/test/documents/1?pretty=true -d '{
"description": "elasticsearch"
}'
curl -XPOST http://localhost:9200/test/documents/_search?pretty=true -d '{
"query": {
"text": {
"description": "elasticsearches"
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment