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

1.9.0 client with elastic 1.7.5 GetIndex (all) fails with exception. #2191

Closed
niemyjski opened this issue Aug 3, 2016 · 2 comments
Closed

Comments

@niemyjski
Copy link
Contributor

I'm calling _client.GetIndex(d => d.AllIndices()); because I want to get all indices... This throw the following error:

Newtonsoft.Json.JsonSerializationException
Error converting value "_none_" to type 'System.Collections.Generic.IEnumerable`1[System.String]'. Path 'default.stopwords', line 1, position 49211.
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Nest.AnalyzerCollectionConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in c:\code\elasticsearch-net\src\Nest\Resolvers\Converters\AnalyzerCollectionConverter.cs:line 52
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
   at Nest.Resolvers.Converters.AnalysisSettingsConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in c:\code\elasticsearch-net\src\Nest\Resolvers\Converters\AnalysisSettingsConverter.cs:line 48
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
   at Nest.Resolvers.Converters.IndexSettingsConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in c:\code\elasticsearch-net\src\Nest\Resolvers\Converters\IndexSettingsConverter.cs:line 138
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Nest.NestSerializer.DeserializeUsingSettings[T](Stream stream, JsonSerializerSettings settings) in c:\code\elasticsearch-net\src\Nest\ExposedInternals\NestSerializer.cs:line 105
   at Nest.NestSerializer.Deserialize[T](Stream stream) in c:\code\elasticsearch-net\src\Nest\ExposedInternals\NestSerializer.cs:line 85
   at Nest.ElasticClient.DeserializeGetIndexResponse(IElasticsearchResponse response, Stream stream) in c:\code\elasticsearch-net\src\Nest\ElasticClient-GetIndex.cs:line 60
   at Elasticsearch.Net.Connection.RequestHandlers.RequestHandler.StreamToTypedResponse[T](ElasticsearchResponse`1 streamResponse, ITransportRequestState requestState, Byte[] readBytes) in c:\code\elasticsearch-net\src\Elasticsearch.Net\Connection\RequestHandlers\RequestHandler.cs:line 251
   at Elasticsearch.Net.Connection.RequestHandlers.RequestHandler.ReturnTypedResponse[T](TransportRequestState`1 requestState, ElasticsearchResponse`1 streamResponse, ElasticsearchServerError& error) in c:\code\elasticsearch-net\src\Elasticsearch.Net\Connection\RequestHandlers\RequestHandler.cs:line 115
   at Elasticsearch.Net.Connection.RequestHandlers.RequestHandler.CoordinateRequest[T](TransportRequestState`1 requestState, Int32 maxRetries, Int32 retried, Boolean& aliveResponse) in c:\code\elasticsearch-net\src\Elasticsearch.Net\Connection\RequestHandlers\RequestHandler.cs:line 134
   at Elasticsearch.Net.Connection.RequestHandlers.RequestHandler.DoRequest[T](TransportRequestState`1 requestState) in c:\code\elasticsearch-net\src\Elasticsearch.Net\Connection\RequestHandlers\RequestHandler.cs:line 177
   at Elasticsearch.Net.Connection.RequestHandlers.RequestHandler.Request[T](TransportRequestState`1 requestState, Object data) in c:\code\elasticsearch-net\src\Elasticsearch.Net\Connection\RequestHandlers\RequestHandler.cs:line 34
   at Elasticsearch.Net.Connection.Transport.DoRequest[T](String method, String path, Object data, IRequestParameters requestParameters) in c:\code\elasticsearch-net\src\Elasticsearch.Net\Connection\Transport.cs:line 343
   at Elasticsearch.Net.ElasticsearchClient.IndicesGet[T](String index, Func`2 requestParameters) in c:\code\elasticsearch-net\src\Elasticsearch.Net\ElasticsearchClient.Generated.cs:line 15176
   at Nest.ElasticClient.Nest.IHighLevelToLowLevelDispatcher.Dispatch[D,Q,R](D descriptor, Func`3 dispatch) in c:\code\elasticsearch-net\src\Nest\ElasticClient.cs:line 74
   at Foundatio.Repositories.Elasticsearch.Configuration.VersionedIndex.GetVersion() in C:\Code\Foundatio.Repositories\src\Elasticsearch\Configuration\VersionedIndex.cs:line 83
   at Foundatio.Repositories.Elasticsearch.Configuration.VersionedIndex.ReindexAsync(Func`3 progressCallbackAsync) in C:\Code\Foundatio.Repositories\src\Elasticsearch\Configuration\VersionedIndex.cs:line 65
   at Foundatio.Repositories.Elasticsearch.Tests.IndexTests.<CanReindexVersionedIndex>d__7.MoveNext() in C:\Code\Foundatio.Repositories\src\Elasticsearch\Tests\IndexTests.cs:line 181
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xunit.Sdk.TestInvoker`1.<>c__DisplayClass46_1.<<InvokeTestMethodAsync>b__1>d.MoveNext() in C:\BuildAgent\work\cb37e9acf085d108\src\xunit.execution\Sdk\Frameworks\Runners\TestInvoker.cs:line 227
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xunit.Sdk.ExecutionTimer.<AggregateAsync>d__4.MoveNext() in C:\BuildAgent\work\cb37e9acf085d108\src\xunit.execution\Sdk\Frameworks\ExecutionTimer.cs:line 48
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xunit.Sdk.ExceptionAggregator.<RunAsync>d__9.MoveNext() in C:\BuildAgent\work\cb37e9acf085d108\src\xunit.core\Sdk\ExceptionAggregator.cs:line 90

System.ArgumentException
Could not cast or convert from System.String to System.Collections.Generic.IEnumerable`1[System.String].
   at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
   at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)

It would be cool if I could have it return a filtered list using a wild card...

@gmarz gmarz added Bug labels Aug 4, 2016
@Mpdreamz
Copy link
Member

The error here is that in 1.x stop words are mapped in various ways either as string or list of strings.

In 2.x we created a special StopWords type that can deal with either with named stopwords _none_, _english_ or manual lists ["a", "the", ...]

Will work on a patch in 1.x that makes sure we can read json in either form and set it to either a string/IEnumerable destination on the POCO.

@niemyjski
Copy link
Contributor Author

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