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
Show child attributes
The document field to filter on.
The user query.
How the results should be displayed and organized.
Show child attributes
* to use Solr's deep paging. This is analogous to start=0. Deep paging is the recommended pagination method.This property is mutually exclusive with start; you can use one but not both.
The pagination offset, that is, the number of skipped results for pagination.
This property is mutually exclusive with cursor; you can use one but not both.
The number of results per page.
The sort field(s) and direction.
Show child attributes
field, expression, relevancy, query The sort order, either ascending (asc) or descending (desc).
asc, desc Search result fields.
Highlighting for instances of query terms in search results.
Show child attributes
The fields to use for highlighting. Highlighting should be used for text fields only. These fields are typically identified by the _t suffix, as in longDescription_t.
The characters immediately preceding a highlighted value. Usually an opening HTML tag.
The characters immediately following a highlighted value. Usually a closing HTML tag.
The highlight snippet length in characters.
The number of highlight snippets to generate for each configured field.
If no highlight match is found in the field, return the leading part of the field instead. Can be used to avoid returning large fields if you need to display something even when there is no highlight match.
true to include the document scores in search results.
Show child attributes
Show child attributes
field, expression, relevancy, query The sort order, either ascending (asc) or descending (desc).
asc, desc The returned facets and facet values.
Show child attributes
Fields designated for faceting.
Show child attributes
The name of the facet field.
A Solr facet prefix, for hierarchical faceting.
The order in which facet values are listed:
count ordering is by documents per term, descending.
index ordering is sorted on term values themselves.
count, index The maximum number of terms to be returned.
The number of top facet values to skip in the response (just like paging through search results and choosing an offset of 51 to start on page 2 when showing 50 results per page).
The minimum count required for a facet field to be included in the response.
The number of documents in the results set which have no value for the facet field.
Range facets.
Show child attributes
The field that functions as a range facet field.
The start of the facet range.
The end of the facet range.
The span of the range as a value to be added to the lower bound.
A boolean parameter that specifies how Solr handles a range gap that cannot be evenly divided between the range start and end values.
If true, the last range constraint will have the facet.range.end value an upper bound.
If false, the last range will have the smallest possible upper bound greater then facet.range.end such that the range is the exact width of the specified range gap. Solr's default value for this parameter is false.
The minimum count required for a range to be included in the response.
By default, the ranges used to compute range faceting between start and end are inclusive of their lower bounds and exclusive of the upper bounds. The "before" range defined with the other parameter is exclusive and the "after" range is inclusive. This default, equivalent to "lower" below, will not result in double counting at the boundaries.
You can use the include parameter to modify this behavior using the following options:
lower - All gap-based ranges include their lower bound.
upper - All gap-based ranges include their upper bound.
edge - The first and last gap ranges include their edge bounds (lower for the first one, upper for the last one) even if the corresponding upper/lower option is not specified.
outer - The "before" and "after" ranges will be inclusive of their bounds, even if the first or last ranges already include those boundaries.
all - Includes all options: lower, upper, edge, outer.
lower, upper, outer, edge, all This parameter specifies that, in addition to the counts for each range constraint between start and end, counts should also be computed for these options:
before - All records with field values lower then lower bound of the first range.
after - All records with field values greater then the upper bound of the last range.
between - All records with field values between the start and end bounds of all ranges.
none - Do not compute any counts.
all - Compute counts for before, between, and after.
before, after, between, non, all true to compute grouped facets for the field facets specified in field parameters. Grouped facets are computed based on the first specified group. As with normal field faceting, fields shouldn't be tokenized (otherwise counts are computed for each token). Grouped faceting supports single and multi-valued fields. Solr's default is false.
unique, header_doc OK
Assorted metadata about the query, such as timing and debug information
Show child attributes
The returned facets and facet values.
Show child attributes
Fields designated for faceting.
Show child attributes
The name of the facet field.
A Solr facet prefix, for hierarchical faceting.
The order in which facet values are listed:
count ordering is by documents per term, descending.
index ordering is sorted on term values themselves.
count, index The maximum number of terms to be returned.
The number of top facet values to skip in the response (just like paging through search results and choosing an offset of 51 to start on page 2 when showing 50 results per page).
The minimum count required for a facet field to be included in the response.
The number of documents in the results set which have no value for the facet field.
Range facets.
Show child attributes
The field that functions as a range facet field.
The start of the facet range.
The end of the facet range.
The span of the range as a value to be added to the lower bound.
A boolean parameter that specifies how Solr handles a range gap that cannot be evenly divided between the range start and end values.
If true, the last range constraint will have the facet.range.end value an upper bound.
If false, the last range will have the smallest possible upper bound greater then facet.range.end such that the range is the exact width of the specified range gap. Solr's default value for this parameter is false.
The minimum count required for a range to be included in the response.
By default, the ranges used to compute range faceting between start and end are inclusive of their lower bounds and exclusive of the upper bounds. The "before" range defined with the other parameter is exclusive and the "after" range is inclusive. This default, equivalent to "lower" below, will not result in double counting at the boundaries.
You can use the include parameter to modify this behavior using the following options:
lower - All gap-based ranges include their lower bound.
upper - All gap-based ranges include their upper bound.
edge - The first and last gap ranges include their edge bounds (lower for the first one, upper for the last one) even if the corresponding upper/lower option is not specified.
outer - The "before" and "after" ranges will be inclusive of their bounds, even if the first or last ranges already include those boundaries.
all - Includes all options: lower, upper, edge, outer.
lower, upper, outer, edge, all This parameter specifies that, in addition to the counts for each range constraint between start and end, counts should also be computed for these options:
before - All records with field values lower then lower bound of the first range.
after - All records with field values greater then the upper bound of the last range.
between - All records with field values between the start and end bounds of all ranges.
none - Do not compute any counts.
all - Compute counts for before, between, and after.
before, after, between, non, all true to compute grouped facets for the field facets specified in field parameters. Grouped facets are computed based on the first specified group. As with normal field faceting, fields shouldn't be tokenized (otherwise counts are computed for each token). Grouped faceting supports single and multi-valued fields. Solr's default is false.
unique, header_doc How the results should be displayed and organized.
Show child attributes
* to use Solr's deep paging. This is analogous to start=0. Deep paging is the recommended pagination method.This property is mutually exclusive with start; you can use one but not both.
The pagination offset, that is, the number of skipped results for pagination.
This property is mutually exclusive with cursor; you can use one but not both.
The number of results per page.
The sort field(s) and direction.
Show child attributes
field, expression, relevancy, query The sort order, either ascending (asc) or descending (desc).
asc, desc Search result fields.
Highlighting for instances of query terms in search results.
Show child attributes
The fields to use for highlighting. Highlighting should be used for text fields only. These fields are typically identified by the _t suffix, as in longDescription_t.
The characters immediately preceding a highlighted value. Usually an opening HTML tag.
The characters immediately following a highlighted value. Usually a closing HTML tag.
The highlight snippet length in characters.
The number of highlight snippets to generate for each configured field.
If no highlight match is found in the field, return the leading part of the field instead. Can be used to avoid returning large fields if you need to display something even when there is no highlight match.
true to include the document scores in search results.
Show child attributes
Show child attributes
field, expression, relevancy, query The sort order, either ascending (asc) or descending (desc).
asc, desc Spellcheck results.
Show child attributes
Show child attributes
A suggested spelling correction for a query term.
Show child attributes
The number of spelling suggestions found for this term.
The starting offset for pagination.
The ending offset for pagination.
The number of times the original, uncorrected query term appears in results.
true if no misspellings are detected in the query terms.
Spellcheck collations for this query.
Show child attributes
The collated query suggestion.
The number of documents matching this collated query.
Data returned by any rules that triggered.
Show child attributes
URLs returned by redirect rules.
An arbitrary JSON blob returned by a Json Blob rule.
Was this page helpful?