Skip to main content
Version: 2.0

Example Search Queries and Results

Below are examples of the main many query parameter groups and their results and some error examples.

The complete search query endpoint path:
search/{clusterName}/{policyName}/?query={terms=""}

Search All

SearchQuery:

query={"terms":"keanu"}

SearchResult:

{
"report": {
"type": "info",
"message": "Success",
"summary": {
"totalCount": 1,
"countDistribution": {
"person": 1
}
}
},
"data": {
"person": {
"documentCount": 1,
"documentData": [
{
"id": "grn:gg:person:3f644b3d-80bb-4b51-9382-f57c48076f97",
"score": 2.390277,
"caption": "Keanu Reeves",
"source": {
"grn": "grn:gg:person:3f644b3d-80bb-4b51-9382-f57c48076f97",
"lastSearchIndexedAt": "2018-07-17T19:02:29+0000",
"born": 1964,
"name": "Keanu Reeves"
}
}
]
}
}
}

Example: Suggest

SearchQuery:

query={"terms":"grn","properties":["grn:gg:person"],"suggester":"completion","maxSuggestSize":1}

SearchResult:

{
"report": {
"type": "info",
"message": "Success",
"summary": {
"totalCount": 1,
"countDistribution": {
"person": 1
}
}
},
"data": {
"person": {
"documentCount": 1,
"documentData": [
{
"text": "grn:gg:person:3a56a5c5-d899-4c0d-a9ec-cfa3e4e89eae",
"id": "grn:gg:person:3a56a5c5-d899-4c0d-a9ec-cfa3e4e89eae",
"score": 1,
"caption": "Milos Forman",
"source": {
"grn": "grn:gg:person:3a56a5c5-d899-4c0d-a9ec-cfa3e4e89eae",
"lastSearchIndexedAt": "2018-07-17T19:02:29+0000",
"born": 1932,
"name": "Milos Forman"
}
}
]
}
}
}

Example: No Result

SearchQuery:

query={"terms":"keanu", "indexes":["movie"], "properties":["title"]}

SearchResult:

{
"report": {
"type": "info",
"message": "No result has been found",
"summary": {
"totalCount": 0
}
}
}

Example 4 - Error

SearchQuery:

query={"terms":"keanu", "indexes":["badactor"]}

SearchResult:

{
"report": {
"type": "error",
"message": "Index [badactor] is not defined in the index policy.",
"summary": {
"totalCount": 0
}
}
}

SearchQuery:

query={"terms":"keanu", "properties":["born"]}

SearchResult:

{
"report": {
"type": "error",
"failures": [
{
"index": "person",
"msg": "Elasticsearch exception [type=illegal_argument_exception, reason=Can only use fuzzy queries on keyword and text fields - not on [born] which is of type [long]]"
}
],
"summary": {
"totalCount": 0
}
}
}