How to use the elastic-builder.requestBodySearch function in elastic-builder

To help you get started, we’ve selected a few elastic-builder examples, based on popular ways it is used in public projects.

github dpc-sdp / ripple / packages / ripple-nuxt-tide / modules / search / lib / search / services / elasticsearch / lib / querybuilder.js View on Github external
excludes.push(esb.existsQuery(exclude.field))
      }
      esbResult = esb.boolQuery().must([
        esb.multiMatchQuery(fields, queryString),
        esb.boolQuery().mustNot(esb.boolQuery().must(excludes))
      ])
    } else {
      esbResult = esb.boolQuery().must(esb.multiMatchQuery(fields, queryString))
    }

    if (Object.keys(filters).length > 0) {
      for (let filterName in filters) {
        addFilter(esbResult, filters[filterName], filterName)
      }
    }
    return esb.requestBodySearch().query(
      esbResult
    )
  },