Query Pipelines APIManaged Fusion Query APIs
The Query Pipelines API allows you to define parameters that should be applied to all queries processed by the system. A query pipeline consists of one or more stages. Query pipeline stages can be defined with the Query Stages API. See the Query language cheat sheet for help constructing queries to send through a query pipeline.
For more information, view the API specification.
Query Pipeline Definition Properties
Property | Description |
---|---|
id |
Required only when creating a new pipeline. |
stages |
A JSON map of the stages to include with the pipeline. The stages can exist already or they can be defined while defining the pipeline. The stage must include the stage definitions:
If the stage supports setting other properties, as defined in the section Query Pipeline Stages, then those can be defined while defining the stage within the pipeline. |
Examples
Get the definition for the default query pipeline:
You can omit the default pipeline name to list the definition for all pipelines, or include an app name in the URL (/api/apps/APP_NAME/query-pipelines ) to list pipelines within a specific app.
|
REQUEST
curl -u USERNAME:PASSWORD https://EXAMPLE_COMPANY.b.lucidworks.cloud/api/query-pipelines/default
RESPONSE
{
"id" : "default",
"stages" : [ {
"type" : "recommendation",
"id" : "recommendation",
"numRecommendations" : 10,
"useFq" : true,
"numSignals" : 100,
"aggrType" : "click@doc_id_s-query_s-filters_s",
"skip" : false
}, {
"type" : "solr-query",
"id" : "solr",
"skip" : false
} ]
}
Create a new query pipeline, specifying a facet stage that is new and a solr-query stage that was previously defined:
REQUEST
curl -u USERNAME:PASSWORD -X POST -H 'Content-Type: application/json' -d '{
"id": "my-pipeline",
"stages": [
{
"type": "facet",
"id": "myFacets",
"fieldFacets": [
{
"field": "data_source_s"
},
{
"field": "author_s",
"minCount": 5,
"missing": true
},
{
"field": "isRetweet_b"
}
],
"skip": false
},
{
"id": "mySolr",
"httpMethod": "POST",
"allowFederatedSearch": false,
"preferredReplicaType": "pull",
"type": "solr-query",
"skip": false,
"responseSignalsEnabled": true
}
}
}' https://EXAMPLE_COMPANY.b.lucidworks.cloud/api/apps/APP_NAME/my-pipeline/query-pipelines
RESPONSE
{
"id" : "my-pipeline",
"stages" : [ {
"type" : "facet",
"id" : null,
"fieldFacets" : [ {
"field" : "data_source_s",
"prefix" : null,
"sort" : null,
"limit" : null,
"offset" : null,
"missing" : null,
"method" : null,
"threads" : null,
"minCount" : null,
"enumCacheMinDf" : null
}, {
"field" : "author_s",
"prefix" : null,
"sort" : null,
"limit" : null,
"offset" : null,
"missing" : true,
"method" : null,
"threads" : null,
"minCount" : 5,
"enumCacheMinDf" : null
}, {
"field" : "isRetweet_b",
"prefix" : null,
"sort" : null,
"limit" : null,
"offset" : null,
"missing" : null,
"method" : null,
"threads" : null,
"minCount" : null,
"enumCacheMinDf" : null
} ],
"skip" : false
}, {
"type" : "solr-query",
"id" : null,
"skip" : false
} ]
}
Query a pipeline named 'default' and a collection named "docs" for the term "solr". Also limit the response to only document 'titles' and return it in JSON format:
REQUEST
curl -u USERNAME:PASSWORD https://EXAMPLE_COMPANY.b.lucidworks.cloud/api/query-pipelines/default/collections/docs/select?q=solr&fl=title&wt=json
RESPONSE
{
"response": {
"numFound": 106,
"start": 0,
"docs": [
{
"title": [
"Solr and SolrAdmin APIs - Fusion Documentation - Lucidworks"
]
},
{
"title": [
"Solr and SolrAdmin APIs - Fusion Documentation - Lucidworks"
]
},
{
"title": [
"Search Clusters - Fusion Documentation - Lucidworks"
]
},
{
"title": [
"Search Clusters - Fusion Documentation - Lucidworks"
]
},
{
"title": [
"Searching - Fusion Documentation - Lucidworks"
]
}
]
},
"responseHeader": {
"status": 0,
"QTime": 1,
"params": {
"fl": "title",
"lw.pipelineId": "default",
"q": "solr",
"wt": "json",
"rows": "5",
"defType": "edismax"
}
}
}