AggregateElasticSearchView

This view is an aggregate of ElasticSearchViews. The view itself does not create any index, but it references the already existing indices of the linked ElasticSearchViews.

When performing queries on the _search endpoint, this view will make use of the multi-index query capabilities of ElasticSearch in order to select the indices of every view present on this aggregate view.

If the caller does not have the permission views/query on all the projects defined on the aggregated view, only a subset of indices (or none) will be selected, respecting the defined permissions.

Aggregate ElasticSearchView

Payload

{
  "@id": "{someid}",
  "@type": "AggregateElasticSearchView",
  "views": [ 
    {
        "project": "{project}",
        "viewId": "{viewId}"
    },
    ...
  ]
}

where…

  • {project}: String - The project, defined as {org_label}/{project_label}, where the {viewId} is located.
  • {viewId}: Iri - The view @id value to be aggregated.

Endpoints

The following sections describe the endpoints that are specific to an AggregateElasticSearchView.

The general view endpoints are described on the parent page.

Search Documents

Provides aggregated search functionality across all the ElasticSearchViews referenced from the target view_id.

POST /v1/views/{org_label}/{project_label}/{view_id}/_search
  {...}

The supported payload is defined on the ElasticSearch documentation

The string documents is used as a prefix of the default ElasticSearch view_id

Example

Request
curl -XPOST -H "Content-Type: application/json" "https://nexus.example.com/v1/views/myorg/myproj/nxv:myview/_search" -d \
'{
  "query": {
    "term": {
      "_deprecated": true
    }
  }
}'
Full source at GitHub
Payload
{
  "query": {
    "term": {
      "_deprecated": true
    }
  }
}
Full source at GitHub
Response
{
  "_shards": {
    "failed": 0,
    "skipped": 0,
    "successful": 0,
    "total": 0
  },
  "hits": {
    "hits": [
      {
        "_score": 1.2039728,
        "_id": "http://example.com/myview",
        "_index": "kg_v1_803da242-d510-4e1a-a12d-d0e0b7018a41_684bd815-9273-46f4-ac1c-0383d4a98254_1",
        "_source": {
          "@id": "http://example.com/myview",
          "@type": [
            "https://bluebrain.github.io/nexus/vocabulary/View",
            "https://bluebrain.github.io/nexus/vocabulary/ElasticSearchView",
            "https://bluebrain.github.io/nexus/vocabulary/Alpha"
          ],
          "_original_source": "{\"mapping\":\"{\\\"dynamic\\\":false,\\\"properties\\\":{\\\"@id\\\":{\\\"type\\\":\\\"keyword\\\"},\\\"@type\\\":{\\\"type\\\":\\\"keyword\\\"},\\\"name\\\":{\\\"type\\\":\\\"keyword\\\"},\\\"number\\\":{\\\"type\\\":\\\"long\\\"},\\\"bool\\\":{\\\"type\\\":\\\"boolean\\\"}}}\",\"_uuid\":\"89dd9858-cf87-4c46-94c2-24da0fcae0aa\",\"@context\":\"https://bluebrain.github.io/nexus/contexts/view\",\"@type\":[\"View\",\"ElasticSearchView\"],\"includeMetadata\":true,\"sourceAsText\":false}",
          "_incoming": "https://nexus.example.com/v1/schemas/myorg/myproj/nxv:myview/incoming",
          "_outgoing": "https://nexus.example.com/v1/schemas/myorg/myproj/nxv:myview/outgoing",
          "_self": "https://nexus.example.com/v1/schemas/myorg/myproj/nxv:myview",
          "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/view",
          "_project": "https://nexus.example.com/v1/projects/myorg/myproj",
          "_rev": 6,
          "_deprecated": true,
          "_createdAt": "2018-09-18T16:39:22.748Z",
          "_createdBy": "https://nexus.example.com/v1/realms/myrealm/users/john",
          "_updatedAt": "2018-09-18T17:10:22.748Z",
          "_updatedBy": "https://nexus.example.com/v1/realms/myrealm/users/john"
        },
        "_type": "doc"
      }
    ],
    "max_score": 1.2039728,
    "total": 1
  },
  "timed_out": false,
  "took": 11
}
Full source at GitHub