BiologicalRecordsCentre / iRecord

Repository to store and track enhancements, issues and tasks regarding the iRecord website.
http://irecord.org.uk
2 stars 1 forks source link

Add website_id = 92 (BNM online) to the ElasticSearch index #863

Closed DavidRoy closed 4 years ago

DavidRoy commented 4 years ago

This website appears in the filter options on the ES explore all page - https://www.brc.ac.uk/irecord/elastic/explore/all but data not shown

Data appears as expected on the old explore page. https://www.brc.ac.uk/irecord/all-records

Is this due to an ES issue?

johnvanbreda commented 4 years ago

Yes, if you update the sharing agreements, this currently needs to be manually updated in the Elasticsearch aliases. Here's a query to grab the list of IDs from PostgreSQL:

select string_agg(from_website_id::text, ', ' order by from_website_id)
from index_websites_website_agreements 
where to_website_id=23
and provide_for_reporting=true

Here's a post that can be used to update the alias:

POST /_aliases
{
  "actions" : [
    { "add" : {
      "index" : "occurrence_brc1_v1",
      "alias" : "occurrence_irecord_report",
      "filter" : {
          "bool" : {
            "must" : [
              {
                "query_string" : {
                  "query" : "metadata.confidential:false AND metadata.release_status:R AND ((metadata.sensitivity_blur:B) OR (!metadata.sensitivity_blur:*))",
                  "analyze_wildcard" : true,
                  "default_field" : "*"
                }
              },
              {
                "terms" : {
                  "metadata.website.id" : [
                    5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, 23, 24, 25, 27, 29, 30, 32, 33, 34, 40, 42, 43, 44, 49, 51, 65, 68, 69, 71, 73, 75, 87, 88, 92, 94, 95, 97, 98, 101, 108, 112, 115, 116, 123
                  ]
                }
              }
            ]
          }
        }
    } }
  ]
}

I've done the update required here.