elastic / elasticsearch-net

This strongly-typed, client library enables working with Elasticsearch. It is the official client maintained and supported by Elastic.
https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/index.html
Apache License 2.0
13 stars 1.15k forks source link

"*" is serialized in correctly when creating api keys. #8377

Closed asal-hesehus closed 1 month ago

asal-hesehus commented 1 month ago

Elastic.Clients.Elasticsearch version: 8.15.8

Elasticsearch version:8.15.1

.NET runtime version:8.0

Operating system version: Windows 11

Description of the problem including expected versus actual behavior: CreateApiKeyRequest, has RoleDescriptors, witch has IndicesPrivileges with Names Names are Indicies. But when setting Indices to "" the "" is converted to "_all". But _all is not supported by the elastic search server.

It is the same issue with GetApiKeyResponse, where the Name is "*" and is then converted to _all when deserilized:

Expected behavior "*" is serialized as {"name":"ElasticKeyName","role_descriptors":{"rolename":{"cluster":["manage_pipeline","manage"],"indices":[{"names":"_all","privileges":["all"]}]}}}

I would expected it to be "" is serialized as {"name":"ElasticKeyName","role_descriptors":{"rolename":{"cluster":["manage_pipeline","manage"],"indices":[{"names":"","privileges":["all"]}]}}}

asal-hesehus commented 1 month ago

I tried to add "a", "b"... as a workaround, but that was not serialized as a string array but as a joined string: {"name":"ElasticKeyName","role_descriptors":{"myname":{"cluster":["manage_pipeline","manage"],"indices":[{"names":"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y*","privileges":["all"]}]}}}

In the documentation: https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html "names" is a array of strings.