Data Stores
/query
Queries the specified data store.
- rights: get
- verbs: GET, POST
| Parameter | Type | Required | Description |
|---|---|---|---|
| store | String | Yes | Names of the data stores to query |
| q | String | Yes | Query string as described below |
| fl | String | No | Comma separated list of property names to return for each matching record. Default returns all properties |
| start | long | No | The starting record to return. Default is 0 |
| rows | long | No | Number of records to return. Default will return 0 records |
| sort | String | No | Order in which to return records. A sort string is made of comma separated parts where each part is a property name followed by one of asc or desc |
| format | String | No | One of csv or json. Default is json. For csv, both documents and facets cannot be returned in 1 request |
The easiest way to learn the query is by studying the following simple examples.
Return all documents:
curl https://test-m1.minusonedb.com/query \
-d "store=index&q=*&rows=10" \
-H "m1-auth-token: $myToken"m1 test-m1 query -store "index" -q '*' -rows 10The simplest query is * which will match all documents. Add a rows parameter to get data other than a count.
All events from a particular IP address:
m1 test-m1 query -store "index" -q "_m1.ip:128.218.229.26"curl https://test-m1.minusonedb.com/query \
-d "store=index&q=_m1.ip:128.218.229.26" \
-H "m1-auth-token: $myToken"To find all events from a particular ip address use a query like _m1.ip:128.218.229.26. In general, the form is property:value.
All events from 2 IP addresses:
m1 test-m1 query -store "index" -q '_m1.ip:("128.218.229.26" OR "72.200.1.74")'curl https://test-m1.minusonedb.com/query \
-d "store=index&q=_m1.ip:("128.218.229.26" OR "72.200.1.74")" \
-H "m1-auth-token: $myToken"To find all events from more than ip address, use OR to separate multiple values: _m1.ip:("128.218.229.26" OR "72.200.1.74").
More than 1 constraint:
m1 test-m1 query -store "index" -q "_m1.ip:("128.218.229.26" OR "72.200.1.74") AND event.type:sessionStart"curl https://test-m1.minusonedb.com/query \
-d "store=index&q=_m1.ip:("128.218.229.26" OR "72.200.1.74") AND event.type:sessionStart" \
-H "m1-auth-token: $myToken"To use multiple constraints, use an AND between individual property terms. The query _m1.ip:(128.218.229.26 OR 72.200.1.74) AND event.type:sessionStart will return events of type sessionStart from 2 the specified ip addresses.
Match against a range of values for a given property:
m1 test-m1 query -store "index" -q "_m1.receivedUTC:[2021-12-25T00:00:00Z TO 2021-12-26T00:00:00}" -sort '_m1.receivedUTC desc'curl https://test-m1.minusonedb.com/query \
-d "store=index&q=_m1.receivedUTC:[2021-12-25T00:00:00Z TO 2021-12-26T00:00:00}&sort=_m1.receivedUTC desc" \
-H "m1-auth-token: $myToken"Ranges let you search against a numeric or date interval: q=_m1.receivedUTC:[2021-12-25T00:00:00Z TO 2021-12-26T00:00:00Z} will return all events received on 12/25/2021. Use [] for inclusive ranges and {} for exclusive ranges.
A more complicated query:
m1 test-m1 query -store "index" -q '_m1.receivedUTC:[2021-12-25T00:00:00Z TO 2021-12-26T00:00:00Z} AND (_m1.ip:"128.218.229.26") AND NOT (event.type:sessionStart)'curl https://test-m1.minusonedb.com/query \
-d 'store=index&q=_m1.receivedUTC:[2021-12-25T00:00:00Z TO 2021-12-26T00:00:00Z} AND (_m1.ip:"128.218.229.26") AND NOT (event.type:sessionStart)' \
-H "m1-auth-token: $myToken"These simple concepts can be combined and composed to make more complicated queries. Our reports interface can help you build queries and display results.
Streaming
This is a streaming endpoint.
/index
Writes all rows in the datalake with _m1key values between start (inclusive) and end (exclusive) to the associated store. Often used when resizing a datastore.
- rights: publish
- verbs: POST
| Parameter | Type | Required | Description |
|---|---|---|---|
| store | String | Yes | Store name |
| start | long | Yes | Inclusive start key |
| end | long | Yes | Exclusive end key |
curl https://test-m1.minusonedb.com/index \
-d "store=index&start=10000&end=30000" \
-H "m1-auth-token: $myToken"m1 test-m1 index -store index -start 10000 -end 30000/store/list
Return a list of all configured data stores.
- rights: get, admin
- verbs: GET
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
curl https://test-m1.minusonedb.com/store/list \
-H "m1-auth-token: $myToken"m1 test-m1 store/list/store/autocommit
Set autocommit frequency of a given store. The autocommit frequency governs how often a store makes recently written data available for searching. For most near real time use cases we recommend a value of 5; a 0 or negative value will turn off autocommit which is recommended for bulk loading use cases.
- rights: admin
- verbs: POST
| Parameter | Type | Required | Description |
|---|---|---|---|
| store | String | Yes | Store name |
| seconds | integer | Yes | Autocommit frequency in seconds |
curl https://test-m1.minusonedb.com/store/autocommit \
-d "store=index&seconds=2" \
-H "m1-auth-token: $myToken"m1 test-m1 store/autocommit -store index -seconds 2/store/add
Add specification for a data store. You will need a corresponding /env/store/create ops service call to provision your data store servers.
- rights: admin
- verbs: POST
| Parameter | Type | Required | Description |
|---|---|---|---|
| store | String | Yes | Store name |
| type | String | Yes | One of standard or boost |
| shards | long | Yes | Number of shards in deployed store |
| replicas | long | Yes | Number of replicas in deployed store |
| percent | double | No | Percentage (0 to 1); store will be sampled to this subset of all published data based on value of _m1rand |
curl https://test-m1.minusonedb.com/store/add \
-d "store=index&shards=1&replicas=2" \
-H "m1-auth-token: $myToken"m1 test-m1 store/add -store index -shards 1 -replicas 2The m1 client can help streamline operations that require coordination between https://ops.minusonedb.com and an environment.
/store/drop
Removes the specification for a data store. You will need to make a corresponding /env/store/destroy ops service call so as not to incur charges for provisioned servers.
- rights: admin
- verbs: POST
| Parameter | Type | Required | Description |
|---|---|---|---|
| store | String | Yes | Store name |
curl https://test-m1.minusonedb.com/store/drop \
-d "store=index" \
-H "m1-auth-token: $myToken"m1 test-m1 store/drop -store indexThe m1 client can help streamline operations that require coordination between https://ops.minusonedb.com and an environment.
/store/rename
Change the name of a data store.
- rights: admin
- verbs: POST
| Parameter | Type | Required | Description |
|---|---|---|---|
| store | String | Yes | Store name |
| name | String | Yes | New store name |
curl https://test-m1.minusonedb.com/store/rename \
-d "store=index&name=newStoreName" \
-H "m1-auth-token: $myToken"m1 test-m1 store/rename -store index -name newStoreNameThe m1 client can help streamline operations that require coordination between https://ops.minusonedb.com and an environment.
/store/enable
Set the data store active status to true/false. A store set to active will be automatically updated when the data lake is updated; an inactive store will not.
- rights: admin
- verbs: POST
| Parameter | Type | Required | Description |
|---|---|---|---|
| store | String | Yes | Store name |
| active | Boolean | Yes | Active status |
curl https://test-m1.minusonedb.com/store/enable \
-d "store=index&active=true" \
-H "m1-auth-token: $myToken"m1 test-m1 store/enable -store index -active true/store/backup/create
Starts a backup of the store; use /store/backup/list to monitor status of the backup.
- rights: admin
- verbs: POST
| Parameter | Type | Required | Description |
|---|---|---|---|
| store | String | Yes | Store name |
| name | String | Yes | Backup name |
curl https://test-m1.minusonedb.com/store/backup/create \
-d "store=index&name=myBackup" \
-H "m1-auth-token: $myToken"m1 test-m1 store/backup/create -store index -name myBackup/store/backup/restore
Begins the restore process of a store from a saved backup. Any data that was previously in the store will be lost once the restore process begins. Use /health to monitor status of the restore; the store server group will require a /reboot to complete the restore process.
- rights: admin
- verbs: POST
| Parameter | Type | Required | Description |
|---|---|---|---|
| store | String | Yes | Store name |
| backup | String | Yes | ID of backup |
curl https://test-m1.minusonedb.com/store/backup/restore \
-d "store=index&backup=5ed16f63-1282-41b6-a880-67635ce5036a" \
-H "m1-auth-token: $myToken"m1 test-m1 store/backup/restore -store index -backup 5ed16f63-1282-41b6-a880-67635ce5036a/store/backup/list
Return a list of all backups associated with this environment.
- rights: admin
- verbs: GET
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
curl https://test-m1.minusonedb.com/store/backup/list \
-H "m1-auth-token: $myToken"m1 test-m1 store/backup/list/store/backup/drop
Remove the specification and all underlying backup data for a data store backup.
WARNING
This operation cannot be undone.
- rights: admin
- verbs: POST
| Parameter | Type | Required | Description |
|---|---|---|---|
| backup | String | Yes | ID of backup |
curl https://test-m1.minusonedb.com/store/backup/drop \
-d "backup=5ed16f63-1282-41b6-a880-67635ce5036a" \
-H "m1-auth-token: $myToken"m1 test-m1 store/backup/drop -backup 5ed16f63-1282-41b6-a880-67635ce5036a/store/backup/rename
Change the name of a store backup.
- rights: admin
- verbs: POST
| Parameter | Type | Required | Description |
|---|---|---|---|
| backup | String | Yes | ID of backup |
| name | String | Yes | New backup name |
curl https://test-m1.minusonedb.com/store/backup/rename \
-d "backup=5ed16f63-1282-41b6-a880-67635ce5036a&name=newBackupName" \
-H "m1-auth-token: $myToken"m1 test-m1 store/backup/rename -backup 5ed16f63-1282-41b6-a880-67635ce5036a -name newBackupName