Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Get all indices, verbose
- GET /_cat/indices?v
- # Create an index with a mapping
- PUT index
- {
- "mappings": {
- "_doc": {
- "properties": {
- "field": {
- "type": "boolean"
- },
- }
- }
- }
- # Delete an index
- DELETE index
- # Clone an index, create the new index with the same mapping first
- POST _reindex
- {
- "source": {
- "index": "original"
- },
- "dest": {
- "index": "destination"
- }
- }
- # All documents in an Index, use size if you want to get more elements
- GET /index/_doc/_search
- {
- "size": 100,
- "query": {
- "match_all": {}
- }
- }
- #Get a single doc
- GET /index/_doc/$_ID
- # Single partial update
- POST /index/_doc/{_id}/_update
- { "doc": {"field": "new_value"} }
- #Bulk partial update
- POST /index/_bulk
- {"update" : {"_id" : "122", "_type" : "_doc"}}
- {"doc" : {"field" : "new_value"}}
- #Ranged query with selected fields, for dates use ISOFORMAT with Zulu ending
- GET /index/_search
- {
- "_source": ["date", "name", "other_field"],
- "query": {
- "range": {"date": {"gte": "2019-06-15", "lte": "2019-06-28"}}}
- }
- # Search with regexp
- GET /index/_doc/_search
- {
- "query": {
- "regexp": {
- "field": "(.*[a-zA-Z].*)"
- }
- }
- }
- #Search with Wildcard
- GET /index/_doc/_search
- {
- "query": {
- "wildcard": {"field": "*text*"}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement