在AWS上查询Elasticsearch

时间:2018-12-05 07:14:39

标签: elasticsearch f# nest ionide

我正在尝试对AWS上的Elasticsearch进行简单查询。但是,当我使用VSCode + Ionide在OSX上执行.fsx文件时,该文件失败,并出现以下异常:

Elasticsearch.Net.UnexpectedElasticsearchClientException: The method or operation is not implemented. ---> System.NotImplementedException: The method or operation is not implemented.
at Elasticsearch.Net.HttpConnection.CreateHttpClientHandler (Elasticsearch.Net.RequestData requestData) [0x00032] in <d540c1f0c16e460aacd9aea9af6a6562>:0
at Elasticsearch.Net.HttpConnection+<>c__DisplayClass2_0.<GetClient>b__0 (System.Int32 h) [0x00000] in <d540c1f0c16e460aacd9aea9af6a6562>:0
at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].GetOrAdd (TKey key, System.Func`2[T,TResult] valueFactory) [0x00034] in <98fac219bd4e453693d76fda7bd96ab0>:0
at Elasticsearch.Net.HttpConnection.GetClient (Elasticsearch.Net.RequestData requestData) [0x00044] in <d540c1f0c16e460aacd9aea9af6a6562>:0
at Elasticsearch.Net.HttpConnection.Request[TResponse] (Elasticsearch.Net.RequestData requestData) [0x00000] in <d540c1f0c16e460aacd9aea9af6a6562>:0
at Elasticsearch.Net.RequestPipeline.CallElasticsearch[TResponse] (Elasticsearch.Net.RequestData requestData) [0x000b9] in <d540c1f0c16e460aacd9aea9af6a6562>:0
at Elasticsearch.Net.Transport`1[TConnectionSettings].Request[TResponse] (Elasticsearch.Net.HttpMethod method, System.String path, Elasticsearch.Net.PostData data, Elasticsearch.Net.IRequestParameters requestParameters) [0x000bc] in <d540c1f0c16e460aacd9aea9af6a6562>:0
--- End of inner exception stack trace ---
at Elasticsearch.Net.Transport`1[TConnectionSettings].Request[TResponse] (Elasticsearch.Net.HttpMethod method, System.String path, Elasticsearch.Net.PostData data, Elasticsearch.Net.IRequestParameters requestParameters) [0x00162] in <d540c1f0c16e460aacd9aea9af6a6562>:0
at Elasticsearch.Net.ElasticLowLevelClient.DoRequest[TResponse] (Elasticsearch.Net.HttpMethod method, System.String path, Elasticsearch.Net.PostData data, Elasticsearch.Net.IRequestParameters requestParameters) [0x00006] in <d540c1f0c16e460aacd9aea9af6a6562>:0
at Elasticsearch.Net.ElasticLowLevelClient.Search[TResponse] (System.String index, System.String type, Elasticsearch.Net.PostData body, Elasticsearch.Net.SearchRequestParameters requestParameters) [0x0003f] in <d540c1f0c16e460aacd9aea9af6a6562>:0
at Nest.LowLevelDispatch.SearchDispatch[TResponse] (Nest.IRequest`1[TParameters] p, Elasticsearch.Net.SerializableData`1[T] body) [0x00100] in <2d6368be93f64ed8850fcce912986a0e>:0
at Nest.ElasticClient.<Search>b__546_0[T,TResult] (Nest.ISearchRequest p, Elasticsearch.Net.SerializableData`1[T] d) [0x00006] in <2d6368be93f64ed8850fcce912986a0e>:0
at Nest.ElasticClient.Nest.IHighLevelToLowLevelDispatcher.Dispatch[TRequest,TQueryString,TResponse] (TRequest request, System.Func`3[T1,T2,TResult] responseGenerator, System.Func`3[T1,T2,TResult] dispatch) [0x00038] in <2d6368be93f64ed8850fcce912986a0e>:0
at Nest.ElasticClient.Nest.IHighLevelToLowLevelDispatcher.Dispatch[TRequest,TQueryString,TResponse] (TRequest request, System.Func`3[T1,T2,TResult] dispatch) [0x00006] in <2d6368be93f64ed8850fcce912986a0e>:0
at Nest.ElasticClient.Search[T,TResult] (Nest.ISearchRequest request) [0x00013] in <2d6368be93f64ed8850fcce912986a0e>:0
at Nest.ElasticClient.Search[T] (Nest.ISearchRequest request) [0x00000] in <2d6368be93f64ed8850fcce912986a0e>:0
at <StartupCode$FSI_0003>.$FSI_0003.main@ () [0x000ab] in <fc8857ba43db4f62b17453fbedc15b9f>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0003b] in <98fac219bd4e453693d76fda7bd96ab0>:0

我正在使用

NEST(6.4)和Elasticsearch.Net.Aws(6.0)

这是我的代码

#I "../.paket/load/netstandard2.0/"

#r "netstandard"
#load "NEST.fsx"
#load "Elasticsearch.Net.Aws.fsx"

open System
open Nest
open Elasticsearch.Net
open Elasticsearch.Net.Aws

type Payload = {latitude: double; longitude: double}
type Telemetry = {payload: Payload}

let credentialsProvider = new AwsCredentials(AccessKey = "my AccessKey", SecretKey = "my SecretKey")
let staticCredentialsProvider = new StaticCredentialsProvider(credentialsProvider)
let httpConnection = new AwsHttpConnection("ap-southeast-2", staticCredentialsProvider)
let pool = new SingleNodeConnectionPool(new Uri("https://search-MY_INDEX-SOME_ID.ap-southeast-2.es.amazonaws.com"))
let config = new ConnectionSettings(pool, httpConnection)
config.DefaultIndex("MY_INDEX") |> ignore
let client = new ElasticClient(config)

let result = client.Search<Telemetry>(new SearchRequest<Telemetry>())

0 个答案:

没有答案