# Elastic, Add Custum Analyzer

**URL:** <https://forum.litium.com/t/elastic-add-custum-analyzer/1701>\
**Category:** Questions\
**Created:** [October 16, 2020, 12:35pm UTC](https://forum.litium.com/t/elastic-add-custum-analyzer/1701 "2020-10-16T12:35:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robin.w](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/robin.w/32/75_2.png) [@Robin.w](https://forum.litium.com/u/Robin.w)\
**Post date:** [October 16, 2020, 12:35pm UTC](https://forum.litium.com/t/elastic-add-custum-analyzer/1701/1 "2020-10-16T12:35:53Z")

</div>

Hi, How can i add analyzers to my index without removing the SynonymAnalyzer?

We need to have the lower\_case analyzer active in one of our index’s but when we add that it removes the SynonymAnalizer and that brakes our search. We use:

```
 public class ProductIndexConfiguration : MultilingualIndexConfigurationBase<ProductDocument>
    {
        protected override CreateIndexDescriptor BuildIndexDescriptor(CultureInfo cultureInfo, CreateIndexDescriptor descriptor)
        {
            return base.BuildIndexDescriptor(cultureInfo, descriptor)
                // add the custom normalizer that will be used together with the keyword analyzer.
                .Settings(s => s.Analysis(a => a.Normalizers(n => n.Custom("my_normalizer", cn => cn.Filters("lowercase")))));
        }

```

To add it, what do we need to include to keep the analyzer configured by litium?

Litium version: 7.4

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [October 18, 2020, 10:02pm UTC](https://forum.litium.com/t/elastic-add-custum-analyzer/1701/2 "2020-10-18T22:02:56Z")

</div>

The thinking was that you should be able to do exactly what you was doing without that you should lose the synonym analyzer. Somehow the third-party component that is used for Elasticsearch connection are replacing any existing configuration when the `Settings` are built.

I have created a [bug](https://docs.litium.com/support/bugs/bug_details?id=52152) about this.

---

<div class="post-metadata">

**Author:** ![Robin.w](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/robin.w/32/75_2.png) [@Robin.w](https://forum.litium.com/u/Robin.w)\
**Post date:** [October 19, 2020, 9:46am UTC](https://forum.litium.com/t/elastic-add-custum-analyzer/1701/3 "2020-10-19T09:46:53Z")

</div>

Oki, one more thing am struggeling with in the product document we have:

```
		[Nested]
		public List<TagItem> Tags { get; set; } = new List<TagItem>();

```

This will automaticly create a nested type, but this dose not work if i use setters:

**this dose not works:**

```
	public class TagItem
	{
		private string _value;
		private string _key;

		[Keyword]
		public string Key
		{
			get => _key;
			set => _key = value.ToLower();
		}

		[Keyword(EagerGlobalOrdinals = true)]
		public string Value
		{
			get => _value;
			set => _value = value.ToLower();
		}
	}

```

**But this works:**

```
public class TagItem
		{
			[Keyword]
			public string Key { get; set ;}

			[Keyword(EagerGlobalOrdinals = true)]
			public string Value { get; set ;}
		}

```

Do you do custom mapping? Do i do this wrong or is this a nest bug?

When the tag index mapping is created it will not be a nested object, if i use a setter in the class.

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [October 19, 2020, 11:30am UTC](https://forum.litium.com/t/elastic-add-custum-analyzer/1701/4 "2020-10-19T11:30:59Z")

</div>

The one that not is working using expression body, will it work if that is using inline body instead?

Ex

```cs
		[Keyword]
		public string Key
		{
			get { return _key; }
			set { _key = value.ToLower(); }
		}

```

---

<div class="post-metadata">

**Author:** ![Robin.w](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/robin.w/32/75_2.png) [@Robin.w](https://forum.litium.com/u/Robin.w)\
**Post date:** [October 19, 2020, 5:19pm UTC](https://forum.litium.com/t/elastic-add-custum-analyzer/1701/5 "2020-10-19T17:19:44Z")

</div>

Thank you, i’ll test this next time, for now i gave up an created a builder method insted of a setter

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [October 21, 2020, 3:56pm UTC](https://forum.litium.com/t/elastic-add-custum-analyzer/1701/6 "2020-10-21T15:56:03Z")

</div>

New pre-release with fix for this is out, see [https://docs.litium.com/documentation/release-notes/pre-release?version=7.4.3-patch-2010211421](https://docs.litium.com/documentation/release-notes/pre-release?version=7.4.3-patch-2010211421)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [November 18, 2020, 3:56pm UTC](https://forum.litium.com/t/elastic-add-custum-analyzer/1701/7 "2020-11-18T15:56:11Z")

</div>

Closed on November 18, 2020, 3:56pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
