How to call method of .NET object in powershell (Elasticsearch NEST .NET client). This is basic example of .NET code for NEST client and I am trying to write PS equivalent but I am failing in setting object value. Is this even possible to do with .NET object in powershell?
.NET example
var config = new Nest.ConnectionSettings(pool, httpConnection)
.DefaultIndex("employee_data"); //complete extensions omitted for brevity
Powershell
$config = new-object -Type Nest.ConnectionSettings($pool, $httpConnection)
$config.DefaultIndex("mate")
Method invocation failed because [Nest.ConnectionSettings] does not contain a method named 'DefaultIndex'.
$config | gm
TypeName: Nest.ConnectionSettings
Name MemberType Definition
---- ---------- ----------
ApiKeyAuthentication Method Nest.ConnectionSettings ApiKeyAuthentication(string id, securestring apiKey), Nest.ConnectionSettings ApiKeyAuthentication(string id, string apiKey), Nest.Co...
BasicAuthentication Method Nest.ConnectionSettings BasicAuthentication(string username, string password), Nest.ConnectionSettings BasicAuthentication(string username, securestring pass...
ClientCertificate Method Nest.ConnectionSettings ClientCertificate(X509Certificate certificate), Nest.ConnectionSettings ClientCertificate(string certificatePath)
ClientCertificates Method Nest.ConnectionSettings ClientCertificates(System.Security.Cryptography.X509Certificates.X509CertificateCollection certificates)
ConnectionLimit Method Nest.ConnectionSettings ConnectionLimit(int connectionLimit)
DeadTimeout Method Nest.ConnectionSettings DeadTimeout(timespan timeout)
DefaultDisableIdInference Method Nest.ConnectionSettings DefaultDisableIdInference(bool disable)
DefaultFieldNameInferrer Method Nest.ConnectionSettings DefaultFieldNameInferrer(System.Func[string,string] fieldNameInferrer)
DefaultIndex Method Nest.ConnectionSettings DefaultIndex(string defaultIndex)
DefaultMappingFor Method Nest.ConnectionSettings DefaultMappingFor[TDocument](System.Func[Nest.ClrTypeMappingDescriptor[TDocument],Nest.IClrTypeMapping[TDocument]] selector), Nest.Co...
DisableAutomaticProxyDetection Method Nest.ConnectionSettings DisableAutomaticProxyDetection(bool disable)
DisableDirectStreaming Method Nest.ConnectionSettings DisableDirectStreaming(bool b)
DisableMetaHeader Method Nest.ConnectionSettings DisableMetaHeader(bool disable)
DisablePing Method Nest.ConnectionSettings DisablePing(bool disable)
Dispose Method void IDisposable.Dispose()
DnsRefreshTimeout Method Nest.ConnectionSettings DnsRefreshTimeout(timespan timeout)
EnableApiVersioningHeader Method Nest.ConnectionSettings EnableApiVersioningHeader(bool enable)
EnableDebugMode Method Nest.ConnectionSettings EnableDebugMode(System.Action[Elasticsearch.Net.IApiCallDetails] onRequestCompleted)
EnableHttpCompression Method Nest.ConnectionSettings EnableHttpCompression(bool enabled)
EnableHttpPipelining Method Nest.ConnectionSettings EnableHttpPipelining(bool enabled)
EnableTcpKeepAlive Method Nest.ConnectionSettings EnableTcpKeepAlive(timespan keepAliveTime, timespan keepAliveInterval)
EnableTcpStats Method Nest.ConnectionSettings EnableTcpStats(bool enableTcpStats)
EnableThreadPoolStats Method Nest.ConnectionSettings EnableThreadPoolStats(bool enableThreadPoolStats)
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
.
.
.
So as you see, Method DefaultIndex is there, so I am confused by this error.