Last active
August 29, 2015 14:24
-
-
Save adrai/4efb524bb34a21595625 to your computer and use it in GitHub Desktop.
elasticsearch spike snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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