Epinova / Epinova.Elasticsearch

A search-plugin for Episerver CMS and Commerce
MIT License
29 stars 20 forks source link

ArgumentNullException during creation of index #108

Closed baier closed 3 years ago

baier commented 4 years ago

This is the error message (see snippet below) we get when trying to create a new index by clicking the "Create / Update" button in ElasticSearchAdmin. From what we can tell, the exception is thrown because we have enabled samii (language code se), which doesn't have a language analyzer (and thus is not supported in your code base). When we then refresh the page, the index is added, but its status is 'Closed'. What is odd is that we previously have been able to add the index - and it has been kept open, but lately we haven't been able to at all. How can be enable support and create an open index for a uncommon language?

[ArgumentNullException: Value cannot be null.
Parameternavn: key]
   System.Dynamic.ExpandoObject.TryAddMember(String key, Object value) +77
   System.Dynamic.ExpandoObject.System.Collections.Generic.IDictionary<System.String,System.Object>.Add(String key, Object value) +9
   Epinova.ElasticSearch.Core.Utilities.Analyzers.CreateAnalyzer(String languageName) in C:\projects\epinova-elasticsearch\src\Epinova.ElasticSearch.Core\Utilities\Analyzers.cs:142
   Epinova.ElasticSearch.Core.Utilities.Analyzers.GetAnalyzerSettings(String languageCode, String synonymsFilePath) in C:\projects\epinova-elasticsearch\src\Epinova.ElasticSearch.Core\Utilities\Analyzers.cs:25
   Epinova.ElasticSearch.Core.Admin.Index.CreateAnalyzerSettings() in C:\projects\epinova-elasticsearch\src\Epinova.ElasticSearch.Core\Admin\Index.cs:245
   Epinova.ElasticSearch.Core.Admin.Index.Initialize(Type type) in C:\projects\epinova-elasticsearch\src\Epinova.ElasticSearch.Core\Admin\Index.cs:157
   Epinova.ElasticSearch.Core.EPiServer.Controllers.ElasticAdminController.AddNewIndex() in C:\projects\epinova-elasticsearch\src\Epinova.ElasticSearch.Core.EPiServer\Controllers\ElasticAdminController.cs:87
   lambda_method(Closure , ControllerBase , Object[] ) +62
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +157
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
   System.Web.Mvc.Async.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +22
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
   System.Web.Mvc.Async.<>c__DisplayClass11_0.<InvokeActionMethodFilterAsynchronouslyRecursive>b__0() +58
   System.Web.Mvc.Async.<>c__DisplayClass11_2.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +228
   System.Web.Mvc.Async.<>c__DisplayClass11_2.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +228
   System.Web.Mvc.Async.<>c__DisplayClass7_0.<BeginInvokeActionMethodWithFilters>b__1(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
   System.Web.Mvc.Async.<>c__DisplayClass3_6.<BeginInvokeAction>b__4() +35
   System.Web.Mvc.Async.<>c__DisplayClass3_1.<BeginInvokeAction>b__1(IAsyncResult asyncResult) +100
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
   System.Web.Mvc.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +11
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +45
   System.Web.Mvc.<>c.<BeginExecute>b__151_2(IAsyncResult asyncResult, Controller controller) +13
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +22
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
   System.Web.Mvc.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +28
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +577
   System.Web.<>c__DisplayClass285_0.<ExecuteStepImpl>b__0() +24
   System.Web.StepInvoker.Invoke(Action executionStep) +100
   System.Web.<>c__DisplayClass4_0.<Invoke>b__0() +17
   Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule.OnExecuteRequestStep(HttpContextBase context, Action step) +64
   System.Web.<>c__DisplayClass284_0.<OnExecuteRequestStep>b__0(Action nextStepAction) +54
   System.Web.StepInvoker.Invoke(Action executionStep) +84
   System.Web.<>c__DisplayClass4_0.<Invoke>b__0() +17
   Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule.OnExecuteRequestStep(HttpContextBase context, Action step) in E:\A\_work\13\s\WEB\Src\Web\Web.Shared.Net\ApplicationInsightsHttpModule.cs:164
   System.Web.<>c__DisplayClass284_0.<OnExecuteRequestStep>b__0(Action nextStepAction) +54
   System.Web.StepInvoker.Invoke(Action executionStep) +84
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +100
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +163
audunru commented 3 years ago

A fix has been to add all the language analyzers to AnalyzerMappings and also to return "english" instead of null in GetLanguageAnalyzer. Just to be able to create the indexes.

However, I'm wondering if the package should perhaps use the "standard" analyzer in all cases where a language analyzer does not exist?

baier commented 3 years ago

A fix has been to add all the language analyzers to AnalyzerMappings and also to return "english" instead of null in GetLanguageAnalyzer. Just to be able to create the indexes.

However, I'm wondering if the package should perhaps use the "standard" analyzer in all cases where a language analyzer does not exist?

I agree with audunru, that does seem like the most reasonable approach.

TopalovOleg commented 3 years ago

@baier @audunru Is there a current workaround for that?

baier commented 3 years ago

@TopalovOleg If I remember it correctly, we initially triggered the creation of indices in the code (but of course it failed whenever someone pressed a button in the GUI), so I think we forked the repo, did a fix there, and just used the fork instead (because we couldn't wait for a fix). And I think the fix was what @audunru mentions in the comment above.

TopalovOleg commented 3 years ago

This is actually, what we are doing on our side also..

otanum commented 3 years ago

https://github.com/Epinova/Epinova.Elasticsearch/releases/tag/v11.7.3.167 Please let us know if it's not working properly.