Skip to content

Empty directory_ index causes ES count query error #57

@derekenos

Description

@derekenos

When the directory_ index is empty, allIndices will be an empty array, which sets the count query terms index_ aggregation size to 0 which ES does not like.

Relevant code

const countQuery = {
     size: 0,
     query: searchQuery.query,
     aggs: {
       collection: {
         terms: {
           field: "_index",
           size: allIndices.length
         }
       }
     }
   }

JS Errors

Search error: [1:185] [terms] failed to parse field [size]
Uncaught (in promise) TypeError: countResponse is null

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions