Skip to content

get_objects fails when passing in attributesToRetrieve #469

Open
@PFStein

Description

@PFStein
  • Algolia Client Version: algolia (2.2.2)
  • Language Version: ruby 2.6.5p114 (2019-10-01 revision 67812) [-darwin21]

Description

When passing in attributesToRetrieve to get_objects we receive an http error stating that attributesToRetrieve is an invalid key. We traced the issue back to the call made to the Algolia API here:

@transporter.read(:POST, '/1/indexes/*/objects', { 'requests': requests }, opts)

We tested that if we pass in request_options instead opts the call works as documented.

Steps To Reproduce

search_config = Algolia::Search::Config.new(
  application_id: 'app_id', api_key: 'api_key', symbolize_keys: false,
)
client = Algolia::Search::Client.new(search_config, { logger: Rails.logger })
index = client.init_index('my_index')
index.get_objects(['1'], { attributesToRetrieve: ["id"] })
# Fails with invalid key 'attributesToRetrieve'. Expected: appID, apiKey, requests (near 1:121)

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