Query Stages API

The Query Stages API provides endpoints to: * manage query stage instances. * list query stage configuration properties * test processing on a set of queries

Examples

Get the properties for the "apply-defaults" type:

REQUEST

curl -u user:pass http://localhost:8764/api/apollo/query-stages/schema/set-params

RESPONSE

{
  "type" : "object",
  "title" : "Set Query Params",
  "description" : "This stage allows you to set, append, and remove query params",
  "properties" : {
    "params" : {
      "type" : "array",
      "title" : "Parameters and Values",
      "items" : {
        "type" : "object",
        "required" : [ "key" ],
        "properties" : {
          "key" : {
            "type" : "string",
            "title" : "Parameter Name"
          },
          "value" : {
            "type" : "string",
            "title" : "Parameter Value"
          },
          "policy" : {
            "type" : "string",
            "title" : "Update Policy",
            "enum" : [ "replace", "append", "remove" ],
            "default" : "append"
          }
        }
      }
    }
  }
}

See all defined query pipeline stages, regardless of type:

REQUEST

curl -u user:pass http://localhost:8764/api/apollo/query-stages/instances

RESPONSE

[{
  "type" : "query-logging",
  "id" : "detailed-logging",
  "detailed" : true,
  "skip" : false,
  "label" : "detailed-query-logging",
}]

Add a new query stage:

REQUEST

curl -u user:pass -X POST -H 'Content-type: application/json' -d'{ "type" : "query-logging", "id" : "detailed-logging", "detailed" : true }' http://localhost:8764/api/apollo/query-stages/instances

RESPONSE

 {
  "type" : "query-logging",
  "id" : "detailed-logging",
  "detailed" : true,
  "skip" : false,
  "label" : "query-logging"
}

Update a query stage:

REQUEST

curl -u user:pass -X PUT -H 'Content-type: application/json' -d'{ "type" : "query-logging", "id" : "detailed-logging", "detailed" : true, "label" : "detailed-query-logging" }' http://localhost:8764/api/apollo/query-stages/instances/detailed-logging

RESPONSE

{
  "type" : "query-logging",
  "id" : "detailed-logging",
  "detailed" : true,
  "skip" : false,
  "label" : "detailed-query-logging",
}

Note that all required elements must be included in the update.

Delete a query stage:

REQUEST

curl -u user:pass -X DELETE http://localhost:8764/api/apollo/query-stages/instances/detailed-logging

No response is returned. To check that the stage is no longer defined, list all query stage instances.

Test that a set-params stage defines properties correctly:

REQUEST

curl -u user:pass -X POST -H 'Content-type: application/json' -d '{"type":"set-params", "params":[{"key":"rows", "value":"2", "policy":"append"}]}' http://localhost:8764/api/apollo/query-stages/solr/test?q=*:*

RESPONSE

{
  "request" : {
    "headers" : {
      "User-Agent" : [ "curl/7.30.0" ],
      "Content-Type" : [ "application/json" ],
      "Accept" : [ "*/*" ],
      "Host" : [ "localhost:8764" ],
      "Content-Length" : [ "80" ]
    },
    "params" : {
      "q" : [ "*:*" ],
      "rows" : [ "2" ]
    }
  },
  "response" : null,
  "totalTime" : 0
}