Skip to main content

Count what a search matches, and the facets of the matches.

POST/api/v1/documents/aggregatedocuments:search

Needs Search Document Metadata for total_count and View Search Facets for facets and facet_values, as the Portal's count and facet routes do. The Search app's total, filter panel and filter-list lookup for one query. query, weights, facet_filters, document_number_prefixes, reference_numbers, date_ranges and exclude_duplicates are the members of POST /documents/search that its Search app engine reads. include lists what to compute: total_count (the number of documents the caller can read that match), facets (the matches counted by each facet, the most frequent values first, and by month of the document date); both by default. facet_values asks for one facet's values containing a text, with the facet's own filter set aside so another value of the same list can be found. A facet value returned here is a value facet_filters takes. A large organisation's facets are estimated from a sample: is_approximate says so.

Scopedocuments:search
AsynchronousNo
MCP toolaggregate_documents
Company capabilitysearch

Parameters​

NameInTypeRequiredDescription
Docwize-Versionheaderstring (date)Optional

Request body​

Content typeType
application/jsonDocumentAggregateQueryInput

Responses​

StatusDescriptionBody
200Success.application/json DocumentAggregate
400invalid_version, malformed_jsonapplication/problem+json Problem
401token_expired, unauthenticatedapplication/problem+json Problem
403forbidden, insufficient_scope, token_owner_inactiveapplication/problem+json Problem
405method_not_allowedapplication/problem+json Problem
406not_acceptableapplication/problem+json Problem
413payload_too_largeapplication/problem+json Problem
415unsupported_media_typeapplication/problem+json Problem
421wrong_regionapplication/problem+json Problem
422unsupported_for_tenant, validation_failedapplication/problem+json Problem
500internal_errorapplication/problem+json Problem
503tenant_unavailable, unavailableapplication/problem+json Problem
504timeoutapplication/problem+json Problem

Errors​

The problem codes this operation can answer with. Each code links to its page.

Schemas​

AggregateFacetValuesInput​

FieldTypeRequiredDescription
containsstring or nullOptionalOnly the values containing this text, ignoring case.
facetstringRequiredThe facet whose values to list: one of the names facet_filters takes.

DocumentAggregate​

FieldTypeRequiredDescription
document_date_monthsarray of FacetBucketRequiredThe matches per month of their document date, value YYYY-MM, oldest first; empty when include leaves facets out.
facet_valuesFacetValues or nullRequiredThe facet_values asked for; null when none was.
facetsarray of FacetCountsRequiredThe matches counted by each facet; empty when include leaves facets out.
is_approximateboolean or nullRequiredThe facet counts were estimated from a sample of a large organisation's documents and scaled up: a rare value may be missing. Null when facets were not computed.
total_countinteger or nullRequiredThe documents the caller can read that match; null when include leaves it out.
truncated_facetsarray of stringRequiredThe facets that have more values than were listed.

DocumentAggregateQueryInput​

FieldTypeRequiredDescription
date_rangesarray of SearchDateRangeInputOptionalKeep the documents whose dates fall in every range.
document_number_prefixesarray of stringOptionalKeep the documents whose number starts with one of these, ignoring case.
exclude_duplicatesboolean or nullOptionalHide the documents that duplicate another document's number.
facet_filtersarray of SearchFacetFilterInputOptionalKeep the documents whose folder, tag, location, file author and so on hold one of the values. The values are the ones POST /documents/aggregate lists.
facet_valuesAggregateFacetValuesInput or nullOptionalList the values of one facet that contain a text.
includearray of stringOptionalWhat to compute: total_count, facets. Both when left out.
querystring or nullOptionalFull text, as in POST /documents/search.
reference_numbersarray of stringOptionalKeep the documents whose reference number contains one of these, ignoring case.
weightsSearchWeightsInput or nullOptionalHow much each field counts towards the score of a match of the query. 0 leaves a field out.

FacetBucket​

FieldTypeRequiredDescription
document_countintegerRequiredThe matching documents that hold the value. ≥ -2147483648; ≤ 2147483647
valuestringRequiredThe value as facet_filters takes it. An empty string counts the documents with no value.

FacetCounts​

FieldTypeRequiredDescription
facetstringRequired
valuesarray of FacetBucketRequired

FacetValues​

FieldTypeRequiredDescription
documents_without_valueintegerRequiredThe matching documents with no value, when the values were not narrowed to a text. ≥ -2147483648; ≤ 2147483647
facetstringRequired
is_approximatebooleanRequiredCounted on a sample of a large organisation's documents and scaled up.
is_truncatedbooleanRequiredMore values than were listed exist: type more of the value to find it.
valuesarray of FacetBucketRequiredThe most frequent first; documents with no value are left out (see documents_without_value).

SearchDateRangeInput​

FieldTypeRequiredDescription
fieldstringRequiredOne of document_date, created_at, file_created_at, file_modified_at.
fromstring (date) or nullOptionalThe first day; open when left out.
tostring (date) or nullOptionalThe last day; open when left out.

SearchFacetFilterInput​

FieldTypeRequiredDescription
facetstringRequiredOne of document_type, document_sub_type, from, to, project, folder, location, tag, created_by, file_content_type, file_author, file_last_author, file_producer, file_title.
valuesarray of SearchFacetValueInputRequiredAlternatives: a document is kept when its facet holds any of them.

SearchFacetValueInput​

FieldTypeRequiredDescription
include_childrenbooleanOptionalWith match exact, also select the values under this one in a hierarchy (a folder's subfolders): the facet starts with the value, ignoring case.
matchstring or nullOptionalexact (the default: the facet equals the value) or contains (the facet contains the text, ignoring case).
valuestringRequiredA value as the facet lists it. An empty string selects the documents with no value.

SearchWeightsInput​

FieldTypeRequiredDescription
ccsinteger or nullOptional
contentinteger or nullOptional
descriptioninteger or nullOptional
document_numberinteger or nullOptional
foldersinteger or nullOptional
frominteger or nullOptional
other_numberinteger or nullOptional
reference_numberinteger or nullOptional
tointeger or nullOptional