import requests
url = "https://{FUSION HOST}/api/query/{id}"
payload = {
"queryDefinition": {
"main": { "type": "<string>" },
"boostsByValues": [
{
"field": "<string>",
"boosts": [
{
"key": "<string>",
"boost": 100
}
]
}
],
"boostsByQuery": [
{
"query": { "type": "<string>" },
"boost": 123,
"type": "<string>"
}
],
"userQuery": "<string>",
"filters": [{ "type": "<string>" }],
"namedFilters": [
{
"name": "<string>",
"query": { "type": "<string>" }
}
],
"groupedQuery": { "type": "<string>" },
"groupedFilters": [{ "type": "<string>" }]
},
"results": {
"cursor": "<string>",
"start": 0,
"size": 123,
"sort": [
{
"type": "field",
"value": "<string>",
"order": "asc",
"query": { "type": "<string>" }
}
],
"fields": ["<string>"],
"highlight": {
"fields": ["<string>"],
"pre": "<em>",
"post": "</em>",
"length": 100,
"count": 1,
"defaultHighlight": False
},
"returnScore": True,
"includeRawResponse": True,
"group": {
"field": "<string>",
"leaderStrategy": { "type": "<string>" },
"sort": [
{
"type": "field",
"value": "<string>",
"order": "asc",
"query": { "type": "<string>" }
}
],
"size": 123
}
},
"params": {},
"context": {},
"facets": {
"fields": [
{
"field": "<string>",
"prefix": "<string>",
"sort": "count",
"limit": 100,
"offset": 0,
"minCount": 123,
"missing": True,
"ensuredValues": ["<string>"],
"domain": {
"additionalFilters": [{ "type": "<string>" }],
"excludedFiltersByName": ["<string>"]
}
}
],
"ranges": [
{
"field": "<string>",
"start": "<string>",
"end": "<string>",
"gap": "<string>",
"hardEnd": True,
"minCount": 123,
"include": ["lower"],
"other": ["before"],
"domain": {
"additionalFilters": [{ "type": "<string>" }],
"excludedFiltersByName": ["<string>"]
}
}
],
"groupFacets": True,
"groupingMethod": "unique"
}
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"meta": {
"timing": {
"total": 123,
"mainQuery": 123,
"pipeline": [
{
"stage": "<string>",
"time": 123
}
]
},
"debug": {
"solrParams": {}
}
},
"facets": {
"fields": [
{
"field": "<string>",
"prefix": "<string>",
"sort": "count",
"limit": 100,
"offset": 0,
"minCount": 123,
"missing": true,
"ensuredValues": [
"<string>"
],
"domain": {
"additionalFilters": [
{
"type": "<string>"
}
],
"excludedFiltersByName": [
"<string>"
]
}
}
],
"ranges": [
{
"field": "<string>",
"start": "<string>",
"end": "<string>",
"gap": "<string>",
"hardEnd": true,
"minCount": 123,
"include": [
"lower"
],
"other": [
"before"
],
"domain": {
"additionalFilters": [
{
"type": "<string>"
}
],
"excludedFiltersByName": [
"<string>"
]
}
}
],
"groupFacets": true,
"groupingMethod": "unique"
},
"results": {
"cursor": "<string>",
"start": 0,
"size": 123,
"sort": [
{
"type": "field",
"value": "<string>",
"order": "asc",
"query": {
"type": "<string>"
}
}
],
"fields": [
"<string>"
],
"highlight": {
"fields": [
"<string>"
],
"pre": "<em>",
"post": "</em>",
"length": 100,
"count": 1,
"defaultHighlight": false
},
"returnScore": true,
"includeRawResponse": true,
"group": {
"field": "<string>",
"leaderStrategy": {
"type": "<string>"
},
"sort": [
{
"type": "field",
"value": "<string>",
"order": "asc",
"query": {
"type": "<string>"
}
}
],
"size": 123
}
},
"spellcheck": {
"suggestions": {},
"correctlySpelled": true,
"collations": [
{
"collationQuery": "<string>",
"hits": 123,
"misspellingsAndCorrections": {}
}
]
},
"debugResponse": {},
"rules": {
"redirects": [
"<string>"
],
"responseValues": {},
"banners": [
{
"url": "<string>",
"zone": "<string>"
}
],
"jsonBlobs": {}
}
}Send a query to a query profile, using Fusion’s Domain Specific Language (DSL). The response contains matching documents, plus statistics about the query operation.
Use the /api/query-profiles endpoint to get the query profile ID for this request.
import requests
url = "https://{FUSION HOST}/api/query/{id}"
payload = {
"queryDefinition": {
"main": { "type": "<string>" },
"boostsByValues": [
{
"field": "<string>",
"boosts": [
{
"key": "<string>",
"boost": 100
}
]
}
],
"boostsByQuery": [
{
"query": { "type": "<string>" },
"boost": 123,
"type": "<string>"
}
],
"userQuery": "<string>",
"filters": [{ "type": "<string>" }],
"namedFilters": [
{
"name": "<string>",
"query": { "type": "<string>" }
}
],
"groupedQuery": { "type": "<string>" },
"groupedFilters": [{ "type": "<string>" }]
},
"results": {
"cursor": "<string>",
"start": 0,
"size": 123,
"sort": [
{
"type": "field",
"value": "<string>",
"order": "asc",
"query": { "type": "<string>" }
}
],
"fields": ["<string>"],
"highlight": {
"fields": ["<string>"],
"pre": "<em>",
"post": "</em>",
"length": 100,
"count": 1,
"defaultHighlight": False
},
"returnScore": True,
"includeRawResponse": True,
"group": {
"field": "<string>",
"leaderStrategy": { "type": "<string>" },
"sort": [
{
"type": "field",
"value": "<string>",
"order": "asc",
"query": { "type": "<string>" }
}
],
"size": 123
}
},
"params": {},
"context": {},
"facets": {
"fields": [
{
"field": "<string>",
"prefix": "<string>",
"sort": "count",
"limit": 100,
"offset": 0,
"minCount": 123,
"missing": True,
"ensuredValues": ["<string>"],
"domain": {
"additionalFilters": [{ "type": "<string>" }],
"excludedFiltersByName": ["<string>"]
}
}
],
"ranges": [
{
"field": "<string>",
"start": "<string>",
"end": "<string>",
"gap": "<string>",
"hardEnd": True,
"minCount": 123,
"include": ["lower"],
"other": ["before"],
"domain": {
"additionalFilters": [{ "type": "<string>" }],
"excludedFiltersByName": ["<string>"]
}
}
],
"groupFacets": True,
"groupingMethod": "unique"
}
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"meta": {
"timing": {
"total": 123,
"mainQuery": 123,
"pipeline": [
{
"stage": "<string>",
"time": 123
}
]
},
"debug": {
"solrParams": {}
}
},
"facets": {
"fields": [
{
"field": "<string>",
"prefix": "<string>",
"sort": "count",
"limit": 100,
"offset": 0,
"minCount": 123,
"missing": true,
"ensuredValues": [
"<string>"
],
"domain": {
"additionalFilters": [
{
"type": "<string>"
}
],
"excludedFiltersByName": [
"<string>"
]
}
}
],
"ranges": [
{
"field": "<string>",
"start": "<string>",
"end": "<string>",
"gap": "<string>",
"hardEnd": true,
"minCount": 123,
"include": [
"lower"
],
"other": [
"before"
],
"domain": {
"additionalFilters": [
{
"type": "<string>"
}
],
"excludedFiltersByName": [
"<string>"
]
}
}
],
"groupFacets": true,
"groupingMethod": "unique"
},
"results": {
"cursor": "<string>",
"start": 0,
"size": 123,
"sort": [
{
"type": "field",
"value": "<string>",
"order": "asc",
"query": {
"type": "<string>"
}
}
],
"fields": [
"<string>"
],
"highlight": {
"fields": [
"<string>"
],
"pre": "<em>",
"post": "</em>",
"length": 100,
"count": 1,
"defaultHighlight": false
},
"returnScore": true,
"includeRawResponse": true,
"group": {
"field": "<string>",
"leaderStrategy": {
"type": "<string>"
},
"sort": [
{
"type": "field",
"value": "<string>",
"order": "asc",
"query": {
"type": "<string>"
}
}
],
"size": 123
}
},
"spellcheck": {
"suggestions": {},
"correctlySpelled": true,
"collations": [
{
"collationQuery": "<string>",
"hits": 123,
"misspellingsAndCorrections": {}
}
]
},
"debugResponse": {},
"rules": {
"redirects": [
"<string>"
],
"responseValues": {},
"banners": [
{
"url": "<string>",
"zone": "<string>"
}
],
"jsonBlobs": {}
}
}Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
The query profile ID.
Defines the logic of what to query for.
Show child attributes
How the results should be displayed and organized.
Show child attributes
Arbitrary query parameters to be added to the underlying Solr query, also used to supply Security Trimming Stage parameters.
Show child attributes
Parameters used by various query stages as well as DSL hints.
Show child attributes
The returned facets and facet values.
Show child attributes
OK
Assorted metadata about the query, such as timing and debug information
Show child attributes
The returned facets and facet values.
Show child attributes
How the results should be displayed and organized.
Show child attributes
Spellcheck results.
Show child attributes
Show child attributes
Data returned by any rules that triggered.
Show child attributes
Was this page helpful?