Skip to content

Instantly share code, notes, and snippets.

@lightsuner
Last active August 29, 2015 14:19
Show Gist options
  • Save lightsuner/5df39112b8507d15ede6 to your computer and use it in GitHub Desktop.
Save lightsuner/5df39112b8507d15ede6 to your computer and use it in GitHub Desktop.
#!/bin/sh
curl -XDELETE 'http://localhost:9200/records' && echo
curl -XPUT 'http://localhost:9200/records' -d '{
"settings": {
"analysis": {
"analyzer": {
"test_analizer": {
"type": "custom",
"tokenizer": "standard",
"filter": ["english_morphology"]
}
}
}
}
}' && echo
curl -XPUT 'http://localhost:9200/records/record/_mapping' -d '{
"record": {
"_all" : {},
"properties": {
"text": {
"analyzer": "test_analizer",
"type": "string"
}
}
}
}' && echo
curl -XPUT 'http://localhost:9200/records/record/1' -d '{"text": "Some text with t char"}' && echo
curl -XPOST 'http://localhost:9200/records/_refresh' && echo
curl -XPOST 'http://localhost:9200/records/_search?pretty' -d '{
"query": {
"filtered": {
"query": {
"query_string": {
"default_field": "text",
"query": "lng"
}
},
"filter": {},
"strategy": "leap_frog_filter_first"
}
},
"highlight": {
"pre_tags": ["<em>"],
"post_tags": ["</em>"],
"fields": {"text": {}}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment