Skip to content

IDs Query

Returns documents based on their IDs.

Example

import (
    es "github.com/elastic/go-elasticsearch/v8"
    "github.com/sdqri/effdsl/v2"
    iq "github.com/sdqri/effdsl/queries/idsquery"
)

query, err := effdsl.Define(
    effdsl.WithQuery(
        iq.IDsQuery("1", "4", "100"),
    ),
)

res, err := es.Search(
    es.Search.WithBody(strings.NewReader(query)),
)

Parameters

  • Values (...string)
    (Required, positional) An array of document IDs. This is a required parameter.

Additional Information

For more details on the IDs query, see the official Elasticsearch documentation on IDs queries.