private void Context_InitComplete(object sender, EventArgs e)
        {
            IVulcanHandler handler = ServiceLocator.Current.GetInstance <IVulcanHandler>();

            // Clear static list so property mapping can be re-created.
            handler.DeletedIndices += ((IEnumerable <string> deletedIndices) =>
            {
                VulcanAttachmentPropertyMapper.AddedMappings.Clear();
            });

            if (_AttachmentSettings.Service.EnableAttachmentPlugins)
            {
                //todo: future 5.x support uses https://www.elastic.co/guide/en/elasticsearch/plugins/5.2/ingest-attachment.html
                // not which 2.x uses https://www.elastic.co/guide/en/elasticsearch/plugins/5.2/mapper-attachments.html

                IVulcanClient client = handler.GetClient(CultureInfo.InvariantCulture);
                var           info   = client.NodesInfo();

                if (info?.Nodes?.Any(x => x.Value?.Plugins?.Any(y => string.Compare(y.Name, "mapper-attachments", true) == 0) == true) != true)
                {
                    if (CurrentHostType != HostType.WebApplication ||
                        (CurrentHostType == HostType.WebApplication && HttpContext.Current?.IsDebuggingEnabled == true))
                    {
                        // Only throw exception if not a web application or is a web application with debug turned on
                        throw new Exception("No attachment plugin found, be sure to install the 'mapper-attachments' plugin on your Elastic Search Server!");
                    }
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Injected constructor
 /// </summary>
 /// <param name="vulcanHandler"></param>
 public VulcanPocoIndexingJob(IVulcanHandler vulcanHandler)
 {
     _VulcanHander    = vulcanHandler;
     _InvariantClient = _VulcanHander.GetClient(CultureInfo.InvariantCulture);
 }