@@ -175,7 +175,6 @@ import { DRAFT_OPERATION_CREATE, DRAFT_OPERATION_DELETE, DRAFT_OPERATION_DELETE_
175175import { RELATION_SAMPLE } from '../modules/malwareAnalysis/malwareAnalysis-types' ;
176176import { asyncMap } from '../utils/data-processing' ;
177177import { doYield } from '../utils/eventloop-utils' ;
178- import type { Mutable } from '../utils/type-utils' ;
179178import { RELATION_COVERED } from '../modules/securityCoverage/securityCoverage-types' ;
180179import type { AuthContext , AuthUser } from '../types/user' ;
181180import type {
@@ -310,7 +309,39 @@ export const elConfigureAttachmentProcessor = async (): Promise<boolean> => {
310309 attachment : {
311310 field : 'file_data' ,
312311 remove_binary : true ,
313- properties : ATTACHMENT_PROCESSOR_EXTRACTED_PROPS_ELASTICSEARCH as Mutable < typeof ATTACHMENT_PROCESSOR_EXTRACTED_PROPS_ELASTICSEARCH > ,
312+ // List of fields extracted by the attachment ingest processor.
313+ // The full list is available in the Elasticsearch docs:
314+ // (https://www.elastic.co/guide/en/elasticsearch/reference/8.19/attachment.html#attachment-fields).
315+ properties : [
316+ 'content' ,
317+ 'title' ,
318+ 'author' ,
319+ 'keywords' ,
320+ 'date' ,
321+ 'content_type' ,
322+ 'content_length' ,
323+ 'language' ,
324+ 'modified' ,
325+ 'format' ,
326+ // identifier, NOT EXTRACTED
327+ // contributor, NOT EXTRACTED
328+ // coverage, NOT EXTRACTED
329+ 'modifier' ,
330+ 'creator_tool' ,
331+ // publisher, NOT EXTRACTED
332+ // relation, NOT EXTRACTED
333+ // rights, NOT EXTRACTED
334+ // source, NOT EXTRACTED
335+ // type, NOT EXTRACTED
336+ 'description' ,
337+ 'print_date' ,
338+ 'metadata_date' ,
339+ // latitude, NOT EXTRACTED
340+ // longitude, NOT EXTRACTED
341+ // altitude, NOT EXTRACTED
342+ // rating, NOT EXTRACTED
343+ 'comments' ,
344+ ] ,
314345 } ,
315346 } ,
316347 ] ,
@@ -327,7 +358,21 @@ export const elConfigureAttachmentProcessor = async (): Promise<boolean> => {
327358 {
328359 attachment : {
329360 field : 'file_data' ,
330- properties : ATTACHMENT_PROCESSOR_EXTRACTED_PROPS_OPENSEARCH as Mutable < typeof ATTACHMENT_PROCESSOR_EXTRACTED_PROPS_OPENSEARCH > ,
361+ // List of fields extracted by the attachment ingest processor, for OpenSearch.
362+ // The full list is available in the OS docs:
363+ // (https://docs.opensearch.org/latest/install-and-configure/additional-plugins/ingest-attachment-plugin/#extracted-information),
364+ // and code shows the check rejects unknown fields with an exception:
365+ // https://github.com/opensearch-project/OpenSearch/blob/315481148edaa43410e2e9f1801ec903fd62ec20/plugins/ingest-attachment/src/main/java/org/opensearch/ingest/attachment/AttachmentProcessor.java#L277
366+ properties : [
367+ 'content' ,
368+ 'title' ,
369+ 'author' ,
370+ 'keywords' ,
371+ 'date' ,
372+ 'content_type' ,
373+ 'content_length' ,
374+ 'language' ,
375+ ] ,
331376 } ,
332377 } ,
333378 {
@@ -2746,11 +2791,11 @@ const buildSubQueryForFilterGroup = (
27462791
27472792 const currentSubQuery = localMustFilters . length > 0
27482793 ? {
2749- bool : {
2750- should : localMustFilters ,
2751- minimum_should_match : mode === 'or' ? 1 : localMustFilters . length ,
2752- } ,
2753- }
2794+ bool : {
2795+ should : localMustFilters ,
2796+ minimum_should_match : mode === 'or' ? 1 : localMustFilters . length ,
2797+ } ,
2798+ }
27542799 : null ;
27552800 return { subQuery : currentSubQuery , postFiltersTags : localPostFilterTags , resultSaltCount : localSaltCount } ;
27562801} ;
@@ -3123,12 +3168,12 @@ const tagFiltersForPostFiltering = (
31233168) => {
31243169 const taggedFilters : ( Filter & { postFilteringTag : string } ) [ ] = filters
31253170 ? extractFiltersFromGroup ( filters , [ INSTANCE_REGARDING_OF , INSTANCE_DYNAMIC_REGARDING_OF ] )
3126- . filter ( ( filter ) => isEmptyField ( filter . operator ) || filter . operator === 'eq' )
3127- . map ( ( filter , i ) => {
3128- const taggedFilter = filter as Filter & { postFilteringTag : string } ;
3129- taggedFilter . postFilteringTag = `${ i } ` ;
3130- return taggedFilter ;
3131- } )
3171+ . filter ( ( filter ) => isEmptyField ( filter . operator ) || filter . operator === 'eq' )
3172+ . map ( ( filter , i ) => {
3173+ const taggedFilter = filter as Filter & { postFilteringTag : string } ;
3174+ taggedFilter . postFilteringTag = `${ i } ` ;
3175+ return taggedFilter ;
3176+ } )
31323177 : [ ] ;
31333178
31343179 if ( taggedFilters . length > 0 ) {
0 commit comments