Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KVStoreCollection using wrong argument in "update_index" #497

Closed
seiimonn opened this issue Nov 18, 2022 · 3 comments
Closed

KVStoreCollection using wrong argument in "update_index" #497

seiimonn opened this issue Nov 18, 2022 · 3 comments

Comments

@seiimonn
Copy link

Describe the bug
When updating the index of a collection the following error is given:

splunklib.binding.HTTPError: HTTP 400 Bad Request -- Argument "index.ho1" is not supported by this handler.

To Reproduce
Steps to reproduce the behavior:

>>> import splunklib.client as client
>>> c = client.connect()
>>> c.kvstore.create("example_collection")
>>> c.kvstore["example_collection"].update_index("get_fast",{"important_field": 1})

Expected behavior
Update of accelerated fields for collection.

Logs or Screenshots

>>> c.kvstore["example_collection"].update_index("get_fast",{"important_field": 1})
/usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.11) or chardet (3.0.4) doesn't match a supported version!
  warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/app/backend/src/lib/splunklib/client.py", line 3622, in update_index
    return self.post(**kwargs)
  File "/app/backend/src/lib/splunklib/client.py", line 1047, in post
    return super(Entity, self).post(path_segment, owner=owner, app=app, sharing=sharing, **query)
  File "/app/backend/src/lib/splunklib/client.py", line 852, in post
    return self.service.post(path, owner=owner, app=app, sharing=sharing, **query)
  File "/app/backend/src/lib/splunklib/binding.py", line 289, in wrapper
    return request_fun(self, *args, **kwargs)
  File "/app/backend/src/lib/splunklib/binding.py", line 70, in new_f
    val = f(*args, **kwargs)
  File "/app/backend/src/lib/splunklib/binding.py", line 769, in post
    response = self.http.post(path, all_headers, **query)
  File "/app/backend/src/lib/splunklib/binding.py", line 1262, in post
    return self.request(url, message)
  File "/app/backend/src/lib/splunklib/binding.py", line 1282, in request
    raise HTTPError(response)
splunklib.binding.HTTPError: HTTP 400 Bad Request -- Argument "index.get_fast" is not supported by this handler.

Splunk (please complete the following information):

  • Version: 9.0.2
  • OS: Ubuntu 20.04 LTS
  • Deployment: tested on single-instance

SDK (please complete the following information):

  • Version: 1.6.19
  • Language Runtime Version: Python 3.7
  • OS: Ubuntu 20.04 LTS

Additional context
I guess that the issue is based on index vs accelerations. An acceleration in a collection is an index on the underlying MongoDB.
Patching the line https://github.com/splunk/splunk-sdk-python/blob/master/splunklib/client.py#L3724 to kwargs['accelerated_fields.' + name] = value if isinstance(value, six.string_types) else json.dumps(value) fixes the issue.

@ashah-splunk
Copy link
Contributor

Hi @seiimonn we are looking into the issue and will get back to you soon.

@akaila-splunk
Copy link
Contributor

Hi @seiimonn , support for accelerated_fields is added in SDK and it will be available in the next release.

@ashah-splunk
Copy link
Contributor

@seiimonn request you to pull the latest SDK release v1.7.3 with the added support and let us know in case of any issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants