function parsePath(pathString, method) {
  let collection
  let operation
  const defaultCollection = 'any'
  const actions = {
    GET: 'get',
    PUT: 'create',
    POST: 'create',
    DELETE: 'delete',
    HEAD: 'exists'
  }
  const suffix = actions[method]

  try {
    const path = pathString.split('/')
    if (method === 'PUT' && path.length === 2) {
      collection = path?.[1] || defaultCollection
      operation = 'index.create'
      return { collection, operation }
    }
    path.forEach((segment, idx) => {
      const prev = idx - 1
      let opname
      if (segment === '_search') {
        collection = path?.[prev] || defaultCollection
        operation = 'search'
      } else if (segment[0] === '_') {
        opname = segment.substring(1)
        collection = path?.[prev] || defaultCollection
        operation = `${opname}.${suffix}`
      }
    })
    if (!operation && !collection) {
      // likely creating an index--no underscore segments
      collection = path?.[1] || defaultCollection
      operation = `index.${suffix}`
    }
  } catch (e) {
    logger.warn('Failed to parse path for operation and collection. Using defaults')
    logger.warn(e)
    collection = defaultCollection
    operation = 'unknown'
  }

  return { collection, operation }
}
Convenience function for parsing the params.path sent to the queryParser
for normalized collection and operation

@param {string} pathString params.path supplied to the query parser
@param {string} method http method called by @elastic/elasticsearch
@returns {object} consisting of collection {string} and operation {string}