Skip to content

Instantly share code, notes, and snippets.

@adrai
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adrai/4efb524bb34a21595625 to your computer and use it in GitHub Desktop.
Save adrai/4efb524bb34a21595625 to your computer and use it in GitHub Desktop.
elasticsearch spike snippets
PUT db1
PUT db1/table1/_mapping
{
"dynamic_templates": [{
"non_analyzed_string": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"type": "string",
"index": "not_analyzed"
}
}
}
]
}
POST _search
{
"query": {
"prefix":
{ "title": "bbb" }
}
}
POST _search
{
"from": 0,
"size": 5,
"sort" : [
{ "age" : "desc" }
],
"query": {
"filtered": {
"filter": {
"and" : [
{
"range" : {
"age" : {
"gte" : 10,
"lte" : 20
}
}
},
{
"term": {
"title": "bbb"
}
}
]
}
}
}
}
POST _search
{
"sort" : [
{ "title" : "asc" }
],
"query": {
"match_all": {}
}
}
POST _search
{
"query": {
"match_all": {}
}
}
POST db1/table1
{
"title": "bbb",
"age": 11
}
GET _all
DELETE db1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment