2013-09-16 17:49:36 -04:00
|
|
|
---
|
2013-09-26 19:22:28 -04:00
|
|
|
layout: doc_page
|
2013-09-16 17:49:36 -04:00
|
|
|
---
|
2013-09-13 18:20:39 -04:00
|
|
|
A search query returns dimension values that match the search specification.
|
|
|
|
|
2013-11-22 18:53:39 -05:00
|
|
|
```json
|
|
|
|
{
|
|
|
|
"queryType": "search",
|
|
|
|
"dataSource": "sample_datasource",
|
|
|
|
"granularity": "day",
|
|
|
|
"searchDimensions": [
|
|
|
|
"dim1",
|
|
|
|
"dim2"
|
|
|
|
],
|
|
|
|
"query": {
|
|
|
|
"type": "insensitive_contains",
|
|
|
|
"value": "Ke"
|
|
|
|
},
|
|
|
|
"sort" : {
|
|
|
|
"type": "lexicographic"
|
|
|
|
},
|
|
|
|
"intervals": [
|
|
|
|
"2013-01-01T00:00:00.000/2013-01-03T00:00:00.000"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
2013-09-13 18:20:39 -04:00
|
|
|
|
|
|
|
There are several main parts to a search query:
|
|
|
|
|
|
|
|
|property|description|required?|
|
|
|
|
|--------|-----------|---------|
|
2013-09-27 20:08:34 -04:00
|
|
|
|queryType|This String should always be "search"; this is the first thing Druid looks at to figure out how to interpret the query|yes|
|
2013-09-13 18:20:39 -04:00
|
|
|
|dataSource|A String defining the data source to query, very similar to a table in a relational database|yes|
|
2013-09-16 19:01:14 -04:00
|
|
|
|granularity|Defines the granularity of the query. See [Granularities](Granularities.html)|yes|
|
|
|
|
|filter|See [Filters](Filters.html)|no|
|
2013-09-13 18:20:39 -04:00
|
|
|
|intervals|A JSON Object representing ISO-8601 Intervals. This defines the time ranges to run the query over.|yes|
|
|
|
|
|searchDimensions|The dimensions to run the search over. Excluding this means the search is run over all dimensions.|no|
|
2013-09-16 19:01:14 -04:00
|
|
|
|query|See [SearchQuerySpec](SearchQuerySpec.html).|yes|
|
2013-09-27 20:08:34 -04:00
|
|
|
|sort|How the results of the search should sorted. Two possible types here are "lexicographic" and "strlen".|yes|
|
2013-09-13 18:20:39 -04:00
|
|
|
|context|An additional JSON Object which can be used to specify certain flags.|no|
|
|
|
|
|
|
|
|
The format of the result is:
|
|
|
|
|
2013-11-22 18:53:39 -05:00
|
|
|
```json
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"timestamp": "2012-01-01T00:00:00.000Z",
|
|
|
|
"result": [
|
|
|
|
{
|
|
|
|
"dimension": "dim1",
|
|
|
|
"value": "Ke$ha"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"dimension": "dim2",
|
|
|
|
"value": "Ke$haForPresident"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"timestamp": "2012-01-02T00:00:00.000Z",
|
|
|
|
"result": [
|
2013-09-13 18:20:39 -04:00
|
|
|
{
|
2013-11-22 18:53:39 -05:00
|
|
|
"dimension": "dim1",
|
|
|
|
"value": "SomethingThatContainsKe"
|
2013-09-13 18:20:39 -04:00
|
|
|
},
|
|
|
|
{
|
2013-11-22 18:53:39 -05:00
|
|
|
"dimension": "dim2",
|
|
|
|
"value": "SomethingElseThatContainsKe"
|
2013-09-13 18:20:39 -04:00
|
|
|
}
|
|
|
|
]
|
2013-11-22 18:53:39 -05:00
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|