Aito Technologies query API
The query API from Aito Technologies — 15 operation(s) for query.
The query API from Aito Technologies — 15 operation(s) for query.
openapi: 3.0.0
info:
title: Aito Technologies data query API
security:
- ApiKeyAuth: []
tags:
- name: query
paths:
/api/v1/jobs/{query}:
post:
tags:
- query
parameters:
- $ref: '#/components/parameters/Query'
description: Create a job for a query
responses:
200:
description: Job info
content:
application/json:
schema:
$ref: '#/components/schemas/JobsResponse'
400:
description: Invalid request body
/api/v1/jobs/:
get:
tags:
- query
description: Get status for all jobs
responses:
200:
description: Job statuses
content:
application/json:
schema:
$ref: '#/components/schemas/JobsStatusResponse'
400:
description: Invalid request body
/api/v1/jobs/{uuid}:
get:
tags:
- query
description: Get status for a job
responses:
200:
description: Job status
content:
application/json:
schema:
$ref: '#/components/schemas/JobsStatusResponse'
400:
description: Invalid request body
/api/v1/jobs/{uuid}/result:
get:
tags:
- query
description: Get result for an evaluate job query
responses:
200:
description: Evaluate job result
content:
application/json:
schema:
$ref: '#/components/schemas/EvaluateResponse'
400:
description: Invalid request body
/api/v1/_search:
post:
tags:
- query
operationId: search
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SearchQuery'
responses:
200:
description: Search results
content:
application/json:
schema:
$ref: '#/components/schemas/DecoratedHits'
400:
description: Invalid request body
/api/v1/_similarity:
post:
tags:
- query
operationId: similarity
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SimilarityQuery'
responses:
200:
description: Similarity results
content:
application/json:
schema:
$ref: '#/components/schemas/DecoratedHits'
400:
description: Invalid request body
/api/v1/_predict:
post:
tags:
- query
operationId: predict
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PredictQuery'
responses:
200:
description: Predict results
content:
application/json:
schema:
$ref: '#/components/schemas/DecoratedHits'
400:
description: Invalid request body
/api/v1/_match:
post:
tags:
- query
operationId: match
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MatchQuery'
responses:
200:
description: Match results
content:
application/json:
schema:
$ref: '#/components/schemas/DecoratedHits'
400:
description: Invalid request body
/api/v1/_recommend:
post:
tags:
- query
operationId: recommend
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RecommendQuery'
responses:
200:
description: Recommend results
content:
application/json:
schema:
$ref: '#/components/schemas/DecoratedHits'
400:
description: Invalid request body
/api/v1/_relate:
post:
tags:
- query
operationId: relate
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RelateQuery'
responses:
200:
description: Relate results
content:
application/json:
schema:
$ref: '#/components/schemas/DecoratedHits'
400:
description: Invalid request body
/api/v1/_query:
post:
tags:
- query
operationId: query
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Query'
responses:
200:
description: Query results
content:
application/json:
schema:
$ref: '#/components/schemas/DecoratedHits'
400:
description: Invalid request body
/api/v1/_aggregate:
post:
tags:
- query
operationId: aggregate
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AggregateQuery'
responses:
200:
description: Aggregate results
content:
application/json:
schema:
$ref: '#/components/schemas/DecoratedHits'
400:
description: Invalid request body
/api/v1/_estimate:
post:
tags:
- query
operationId: estimate
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/EstimateQuery'
responses:
200:
description: Estimate results
content:
application/json:
schema:
$ref: '#/components/schemas/EstimateResult'
400:
description: Invalid request body
/api/v1/_evaluate:
post:
tags:
- query
operationId: evaluate
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/EvaluateQueryBase'
responses:
200:
description: Evaluate results
content:
application/json:
schema:
$ref: '#/components/schemas/EvaluateResponse'
400:
description: Invalid request body
/api/v1/_batch:
post:
tags:
- query
operationId: batch
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BatchQuery'
responses:
200:
description: Batch results
content:
application/json:
schema:
$ref: '#/components/schemas/BatchQueryResults'
400:
description: Invalid request body
components:
schemas:
Hit:
example:
$hit: price
examples:
- $hit: price
- $hit: $similarity
- from: impressions
where:
product.title:
$match: iphone
get: product
orderBy:
$multiply:
- $hit: $similarity
- $hit: price
type: object
properties:
$hit:
$ref: '#/components/schemas/Score'
HighlightProjection:
example: $highlight
type: string
enum:
- $highlight
SortField:
example: $sort
type: string
enum:
- $sort
Knn:
example:
$knn:
- 4
- tags: laptop
examples:
- $knn:
- 4
- tags: laptop
- $knn:
k: 4
near:
tags: laptop
type: object
properties:
$knn:
oneOf:
- $ref: '#/components/schemas/KnnPropositionObject'
- $ref: '#/components/schemas/KnnPropositionArray'
EvaluateResponse:
type: object
required:
- n
- testSamples
- trainSamples
- features
- error
- baseError
- accuracy
- baseAccuracy
- accuracyGain
- meanRank
- baseMeanRank
- rankGain
- informationGain
- mxe
- h
- geomMeanP
- baseGmp
- geomMeanLift
- meanNs
- meanUs
- meanMs
- medianNs
- medianUs
- medianMs
- warmingMs
properties:
n:
description: 'The amount of samples used for testing. Alias for `testSamples`.
'
type: integer
format: int64
testSamples:
description: 'The amount of samples used for testing.
'
type: integer
format: int64
trainSamples:
description: 'The average amount of samples used for training.
'
type: number
features:
description: 'The average number of features
'
type: number
error:
description: 'Complement of `accuracy` (=`1 - accuracy`).
'
type: number
baseError:
description: 'Complement of `baseAccuracy` (=`1 - baseAccuracy`).
'
type: number
accuracy:
description: 'The accuracy of predictions.
'
type: number
baseAccuracy:
description: 'The simulated accuracy of predictions based on taking the most frequent value. This is not the actual Aito accuracy, but useful to understand how much better results Aito can provide.
'
type: number
accuracyGain:
description: 'How much better results Aito was able to provide compared to a naive prediction. `accuracy - baseAccuracy`.
'
type: number
meanRank:
description: 'Average rank of the best prediction
'
type: number
baseMeanRank:
description: ''
type: number
rankGain:
description: 'Improvement of meanRank upon baseMeanRank
'
type: number
informationGain:
description: 'A measurement which describes the quality of probabilities (=`h - mxe`).
'
type: number
mxe:
description: 'Mean cross entropy
'
type: number
h:
description: 'Entropy
'
type: number
geomMeanP:
description: 'The mean geometric probability of the predictions
'
type: number
baseGmp:
description: 'Base geometric mean probability.
'
type: number
geomMeanLift:
description: 'Geometric mean lift. `geomMeanP / baseGmp`
'
type: number
meanNs:
description: 'The mean execution time of the queries in nanoseconds.
'
type: number
meanUs:
description: 'The mean execution time of the queries in microseconds.
'
type: number
meanMs:
description: 'The mean execution time of the queries in milliseconds.
'
type: number
medianNs:
description: 'The median execution time of the queries in nanoseconds.
'
type: number
medianUs:
description: 'The median execution time of the queries in microseconds.
'
type: number
medianMs:
description: 'The median execution time of the queries in milliseconds.
'
type: number
warmingMs:
description: 'The time spent for warm-up of indexes and caches for the given query in milliseconds.
'
type: number
IntArray:
example:
- 1
- 2
- 3
type: array
items:
type: integer
format: int32
AggregateProjection:
example: price.$mean
oneOf:
- $ref: '#/components/schemas/AggregateList'
- $ref: '#/components/schemas/AggregateMean'
- $ref: '#/components/schemas/AggregateSum'
- $ref: '#/components/schemas/AggregateFrequency'
- $ref: '#/components/schemas/FrequencyAggregateField'
- $ref: '#/components/schemas/AggregateField'
- $ref: '#/components/schemas/NamedAggregateProjection'
Mod:
example:
$mod:
- 2
- 0
examples:
- $mod:
- 2
- 0
- $mod:
divisor: 2
remainder: 0
- from: products
where:
price:
$mod:
divisor: 2
remainder: 0
type: object
properties:
$mod:
oneOf:
- $ref: '#/components/schemas/ModPropositionObject'
- $ref: '#/components/schemas/ModPropositionArray'
ScoreField:
example: $score
type: string
enum:
- $score
Hash:
example:
$hash:
$mod:
- 2
- 1
type: object
properties:
$hash:
oneOf:
- $ref: '#/components/schemas/Proposition'
- $ref: '#/components/schemas/PrimitiveProposition'
EvaluateGenericQuery:
type: object
example:
from: impressions
get: product
limit: 20
offset: 10
required:
- from
properties:
from:
example: impressions
$ref: '#/components/schemas/From'
where:
$ref: '#/components/schemas/Proposition'
get:
example: product
$ref: '#/components/schemas/Get'
orderBy:
$ref: '#/components/schemas/OrderBy'
select:
$ref: '#/components/schemas/Projection'
offset:
example: 10
type: integer
format: int64
description: The number of results to skip from the beginning.
default: 0
limit:
example: 20
type: integer
format: int64
description: The maximum number of results to retrieve.
default: 10
Not:
example:
$not:
tags: laptop
examples:
- $not:
tags: laptop
- $not:
$lt: 0
- from: products
where:
price:
$not:
$lt: 1.1
type: object
properties:
$not:
oneOf:
- $ref: '#/components/schemas/Proposition'
- $ref: '#/components/schemas/PrimitiveProposition'
GteExplanation:
type: object
properties:
$gte:
oneOf:
- $ref: '#/components/schemas/IntArray'
- $ref: '#/components/schemas/LongArray'
- $ref: '#/components/schemas/DecimalArray'
- $ref: '#/components/schemas/StringArray'
- $ref: '#/components/schemas/BooleanArray'
- type: object
- type: object
- type: object
- type: object
- type: object
- type: integer
format: int32
- type: integer
format: int64
- type: number
- type: boolean
- type: 'null'
- type: string
- type: object
AndExplanation:
type: object
properties:
$and:
type: array
items:
$ref: '#/components/schemas/PropositionExplanation'
AggregateSum:
example:
$sum: visits
examples:
- $sum: visits
- $sum: purchase
type: object
properties:
$sum:
$ref: '#/components/schemas/Score'
NnPropositionObject:
type: object
example:
near:
tags: laptop
required:
- near
properties:
near:
example:
tags: laptop
oneOf:
- $ref: '#/components/schemas/Proposition'
- $ref: '#/components/schemas/PrimitiveProposition'
threshold:
type: number
EvaluateNumericOperation:
type: object
example:
estimate: price
from: products
where:
category:
$get: category
required:
- from
- estimate
properties:
from:
example: products
$ref: '#/components/schemas/From'
where:
example:
category:
$get: category
$ref: '#/components/schemas/Proposition'
estimate:
example: price
type: string
basedOn:
$ref: '#/components/schemas/PropositionSet'
Query:
type: object
example:
from: impressions
get: product
limit: 20
offset: 10
required:
- from
properties:
from:
example: impressions
$ref: '#/components/schemas/From'
where:
$ref: '#/components/schemas/Proposition'
get:
example: product
$ref: '#/components/schemas/Get'
orderBy:
$ref: '#/components/schemas/OrderBy'
select:
$ref: '#/components/schemas/Projection'
offset:
example: 10
type: integer
format: int64
description: The number of results to skip from the beginning.
default: 0
limit:
example: 20
type: integer
format: int64
description: The maximum number of results to retrieve.
default: 10
HighlightParams:
type: object
example:
encoder: html
negPostTag: </em>
negPreTag: <em>
negThreshold: 0.9
posPostTag: </b>
posPreTag: <b>
posThreshold: 1.1
properties:
posPreTag:
example: <b>
type: string
posPostTag:
example: </b>
type: string
negPreTag:
example: <em>
type: string
negPostTag:
example: </em>
type: string
posThreshold:
example: 1.1
type: number
negThreshold:
example: 0.9
type: number
encoder:
example: html
type: string
NamedAggregateProjection:
example:
aggregate:
clicks:
$f:
click: true
ctr:
$mean: click
impressions: $f
from: impressions
where:
product.name: MyProduct
examples:
- aggregate:
clicks:
$f:
click: true
ctr:
$mean: click
impressions: $f
from: impressions
where:
product.name: MyProduct
- failureCount:
$f:
success: false
type: object
Hits:
example:
- $p: 0.16772371915637704
category: '100'
id: '6410405060457'
name: Pirkka bio cherry tomatoes 250g international 1st class
price: 1.29
tags: fresh vegetable pirkka tomato
- $p: 0.16772371915637704
category: '100'
id: '6410405093677'
name: Pirkka iceberg salad Finland 100g 1st class
price: 1.29
tags: fresh vegetable pirkka
type: array
items:
$ref: '#/components/schemas/ResponseHit'
EvaluateGroupedOperation:
example:
from: impressions
goal:
purchase: 'true'
recommend: product
where:
product.name:
$get: query
session.user:
$get: session.user
examples:
- from: impressions
goal:
purchase: 'true'
recommend: product
where:
product.name:
$get: query
session.user:
$get: session.user
- from: impressions
get: product
orderBy:
$p:
purchase: true
where:
product.name:
$get: query
session.user:
$get: session.user
oneOf:
- $ref: '#/components/schemas/EvaluateMultiGenericQuery'
- $ref: '#/components/schemas/EvaluateRecommend'
EvaluateGroupedQuery:
type: object
example:
evaluate:
from: impressions
goal:
purchase: 'true'
recommend: product
where:
product.name:
$get: query
session.user:
$get: session.user
group: userGroup
select:
- accuracy
- meanRank
- n
test:
userGroup:
$gte: 5
required:
- group
- evaluate
properties:
train:
$ref: '#/components/schemas/Proposition'
test:
example:
userGroup:
$gte: 5
$ref: '#/components/schemas/Proposition'
testSource:
$ref: '#/components/schemas/TestSource'
select:
example:
- accuracy
- meanRank
- n
$ref: '#/components/schemas/Selection'
group:
example: userGroup
type: string
goal:
$ref: '#/components/schemas/Proposition'
evaluate:
example:
from: impressions
goal:
purchase: 'true'
recommend: product
where:
product.name:
$get: query
session.user:
$get: session.user
$ref: '#/components/schemas/EvaluateGroupedOperation'
Numeric:
example:
$numeric: 42
examples:
- $numeric: 42
- $numeric: 3.14
type: object
properties:
$numeric:
oneOf:
- $ref: '#/components/schemas/GetValueExpression'
- type: integer
format: int32
- type: integer
format: int64
- type: number
- type: 'null'
Exists:
example:
$exists:
- query
- product.tags
examples:
- $exists:
- query
- product.tags
- from: impressions
where:
$on:
- $exists:
- query
- customer.tags
- click: true
relate:
- product.title
- product.tags
type: object
properties:
$exists:
$ref: '#/components/schemas/PropositionSet'
FrequencyAggregateField:
example: $f
type: string
enum:
- $f
PField:
example: $p
type: string
enum:
- $p
AscGenericQuery:
example:
$asc: price
examples:
- $asc: price
- $asc: product.price
- $asc:
$multiply:
- product.price
- $p
type: object
properties:
$asc:
$ref: '#/components/schemas/Value'
RegressionExplanation:
example:
operation: reduction
proposition:
category: dairy
regressionType: categorical
residual: null
type: regression
value: -0.234
examples:
- operation: reduction
proposition:
category: dairy
regressionType: categorical
residual: null
type: regression
value: -0.234
- operation: reduction
proposition:
sale_price: 20.0
regressionType: linear
residual: 2.427
type: regression
value: -0.234
type: object
required:
- type
- proposition
- value
- regressionType
- operation
properties:
type:
description: 'The explanation type: regression.
'
enum:
- regression
type: string
proposition:
description: 'The field-value proposition that triggered this regression adjustment.
'
$ref: '#/components/schemas/PropositionExplanation'
value:
description: 'The regression effect/contribution to the score.
'
type: number
regressionType:
description: 'The type of regression: ''categorical'' (group effects) or ''linear'' (OLS).
'
type: object
residual:
description: 'For linear regression: the predictor''s residual value after its own transformation pipeline.
'
type: number
operation:
description: 'The operation: ''reduction'' (removing effect) or ''restoration'' (adding effect back).
'
type: object
IsPropositionExplanation:
oneOf:
- $ref: '#/components/schemas/IntArray'
- $ref: '#/components/schemas/LongArray'
- $ref: '#/components/schemas/DecimalArray'
- $ref: '#/components/schemas/StringArray'
- $ref: '#/components/schemas/BooleanArray'
- type: object
- type: object
- type: object
- type: object
- type: object
- type: integer
format: int32
- type: integer
format: int64
- type: number
- type: boolean
- type: 'null'
- type: string
- type: object
StringArray:
example:
- red
- green
- blue
type: array
items:
type: string
PlainProbability:
example: $p
examples:
- $p
- from: messages
get: user
orderBy: $p
where:
message:
$match: dog
type: string
enum:
- $p
MatchesProjection:
example: $matches
type: string
enum:
- $matches
PropositionExplanation:
oneOf:
- $ref: '#/components/schemas/FieldPropositionExplanation'
- $ref: '#/components/schemas/HasExplanation'
- $ref: '#/components/schemas/AndExplanation'
- $ref: '#/components/schemas/OrExplanation'
- $ref: '#/components/schemas/OnExplanation'
- $ref: '#/components/schemas/NotExplanation'
- $ref: '#/components/schemas/StartsWithExplanation'
- $ref: '#/components/schemas/GtExplanation'
- $ref: '#/components/schemas/GteExplanation'
- $ref: '#/components/schemas/LtExplanation'
- $ref: '#/components/schemas/LteExplanation'
- $ref: '#/components/schemas/DefinedExplanation'
- $ref: '#/components/schemas/NumericExplanation'
- $ref: '#/components/schemas/KnnExplanation'
- $ref: '#/components/schemas/NnExplanation'
- $ref: '#/components/schemas/IsPropositionExplanation'
KnnPropositionArray:
example:
- 4
- tags: laptop
type: array
minItems: 2
maxItems: 2
items:
oneOf:
- type: integer
format: int32
- oneOf:
- $ref: '#/components/schemas/Proposition'
- $ref: '#/components/schemas/PrimitiveProposition'
Sum:
example:
$sum:
- priceNet
- priceVat
type: object
properties:
$sum:
oneOf:
- $ref: '#/components/schemas/ContextValueQuery'
- type: array
items:
$ref: '#/components/schemas/Score'
DivisionExplanation:
example:
dividend:
field: return
type: field
value: 400000.0
divisor:
field: investment
type: field
value: 250000.0
type: division
type: object
required:
- type
- dividend
- divisor
properties:
type:
description: 'The explanation type: divide.
'
enum:
- division
type: string
dividend:
description: 'The divided value.
'
$ref: '#/components/schemas/ScoreExplanation'
divisor:
description: 'The divider value.
'
$ref: '#/components/schemas/ScoreExplanation'
Decision:
example:
$decision:
score:
$mean:
$context: clickThroughRate
seed: 0
type: object
properties:
$decision:
type: object
properties:
score:
$ref: '#/components/schemas/Score'
seed:
type: integer
format: int64
LogarithmicExplanation:
example:
inner:
type: constant
value: 0.173
type: log
value: -1.754
type: object
required:
- type
- value
- inner
properties:
type:
description: 'The explanation type: log (logarithmic transformation).
'
enum:
- log
type: string
value:
description: 'The logarithmic score value log(inner).
'
type: number
inner:
description: 'The explanation in linear space that gets log-transformed.
'
$ref: '#/components/schemas/ScoreExplanation'
RecommendQuery:
type: object
example:
from: impressions
goal:
click: true
limit: 2
offset: 2
recommend: product
select:
- title
- description
- price
where:
customer: 4
query: laptop
required:
- from
- recommend
- goal
properties:
from:
example: impressions
$ref: '#/components/schemas/From'
where:
example:
customer: 4
query: laptop
$ref: '#/components/schemas/Proposition'
recommend:
example: product
$ref: '#/components/schemas/Get'
basedOn:
$ref: '#/components/schemas/PropositionSet'
goal:
example:
click: true
$ref: '#/components/schemas/Goal'
select:
example:
- title
- description
- price
$ref: '#/components/schemas/Projection'
offset:
example: 2
type: integer
format: int64
description: The number of results to skip from the beginning.
default: 0
limit:
example: 2
type: integer
format: int64
description: The maximum number of results to retrieve.
default: 10
ExponentExplanation:
example:
base:
type: idf
value: 1.7551720221592049
power:
type: tf
value: 1.0
type: exponent
value: 1.7551720221592049
type: object
required:
- type
- value
- base
- power
properties:
type:
description: 'The explanation type: exponent.
'
enum:
- exponent
type: string
value:
description: 'The exponent score.
'
type: number
base:
description: 'The explanation of the base score element.
'
$ref: '#/components/schemas/ScoreExplanation'
power:
description: 'The explanation of the power score element.
'
$ref: '#/components/schemas/ScoreExplanation'
NoneExplanation:
example:
type: none
type: object
required:
- type
properties:
type:
description: 'The explanation type: none
'
enum:
- none
type: string
Match:
example:
$match: coffee
examples:
- $match: coffee
- from: products
where:
name:
$match: coffee
type: object
properties:
$match:
oneOf:
- $ref: '#/components/schemas/ToString'
- $ref: '#/components/schemas/GetValueExpression'
- type: string
KnnPropositionObject:
type: object
example:
k: 4
near:
tags: laptop
required:
- k
- near
properties:
k:
example: 4
type: integer
format: int32
near:
example:
tags: laptop
oneOf:
- $ref: '#/components/schemas/Proposition'
- $ref: '#/components/schemas/PrimitiveProposition'
ScoreOperator:
example: $p
examples:
- $p
- $similarity
- $multiply:
- $p
- margin
oneOf:
- $ref: '#/components/schemas/PlainProbability'
# --- truncated at 32 KB (102 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/aito-technologies/refs/heads/main/openapi/aito-technologies-query-api-openapi.yml