# Nest Custom analyser

**URL:** <https://discuss.elastic.co/t/nest-custom-analyser/17349>\
**Category:** Elasticsearch\
**Created:** [May 5, 2014, 1:18pm UTC](https://discuss.elastic.co/t/nest-custom-analyser/17349 "2014-05-05T13:18:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcio\_Rodrigues](https://avatars.discourse-cdn.com/v4/letter/m/df705f/32.png) [@Marcio\_Rodrigues](https://discuss.elastic.co/u/Marcio_Rodrigues)\
**Post date:** [May 5, 2014, 1:18pm UTC](https://discuss.elastic.co/t/nest-custom-analyser/17349/1 "2014-05-05T13:18:55Z")

</div>

Hi

Hoping there are some nest users here who could help me out.

I am trying to figure out how to specify cutom field analyzers on a Poco  
class , so that when it get's indexed automatically via Nest the fields  
will be appropriately anlyzed.

But I can't seem to find a way to specify a custom Analyzer for a field in  
a Poco ( have searched the documentation as well and not found any help)  
Is this possible , or do I have to do the mappings manually before?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/293cc2c5-2f23-4698-85b7-309fb15de9b9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/293cc2c5-2f23-4698-85b7-309fb15de9b9%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Itamar\_Syn\_Hershko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/itamar_syn_hershko/32/725_2.png) [@Itamar\_Syn\_Hershko](https://discuss.elastic.co/u/Itamar_Syn_Hershko)\
**Post date:** [May 5, 2014, 4:44pm UTC](https://discuss.elastic.co/t/nest-custom-analyser/17349/2 "2014-05-05T16:44:18Z")

</div>

This should work:

```
[ElasticProperty(Analyzer = "my_analyzer")]
public string Content { get; set;}

```

You can also specify Index/SearchAnalyzer this way (for fine-grained  
control)

--

Itamar Syn-Hershko  
[http://code972.com](http://code972.com) | @synhershko [https://twitter.com/synhershko](https://twitter.com/synhershko)  
Freelance Developer & Consultant  
Author of RavenDB in Action [http://manning.com/synhershko/](http://manning.com/synhershko/)

On Mon, May 5, 2014 at 4:18 PM, Marcio Rodrigues [marshy1001@gmail.com](mailto:marshy1001@gmail.com)wrote:

> Hi
> 
> Hoping there are some nest users here who could help me out.
> 
> I am trying to figure out how to specify cutom field analyzers on a Poco  
> class , so that when it get's indexed automatically via Nest the fields  
> will be appropriately anlyzed.
> 
> But I can't seem to find a way to specify a custom Analyzer for a field in  
> a Poco ( have searched the documentation as well and not found any help)  
> Is this possible , or do I have to do the mappings manually before?
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/293cc2c5-2f23-4698-85b7-309fb15de9b9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/293cc2c5-2f23-4698-85b7-309fb15de9b9%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/293cc2c5-2f23-4698-85b7-309fb15de9b9%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/293cc2c5-2f23-4698-85b7-309fb15de9b9%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAHTr4ZuWBL7xB-HG2xOR-59ufXLXAWz7C9-JL-%2BZBJiD5mWh2g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHTr4ZuWBL7xB-HG2xOR-59ufXLXAWz7C9-JL-%2BZBJiD5mWh2g%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Marcio\_Rodrigues](https://avatars.discourse-cdn.com/v4/letter/m/df705f/32.png) [@Marcio\_Rodrigues](https://discuss.elastic.co/u/Marcio_Rodrigues)\
**Post date:** [May 5, 2014, 4:50pm UTC](https://discuss.elastic.co/t/nest-custom-analyser/17349/3 "2014-05-05T16:50:18Z")

</div>

Thanks Itamar

Would "my\_analyzer" in this case be an analyzer i defined in code myself  
or would it have to have been already created in ES?

On Monday, May 5, 2014 5:44:18 PM UTC+1, Itamar Syn-Hershko wrote:

> This should work:
> 
> ```
> [ElasticProperty(Analyzer = "my_analyzer")]
> public string Content { get; set;}
> 
> ```
> 
> You can also specify Index/SearchAnalyzer this way (for fine-grained  
> control)
> 
> --
> 
> Itamar Syn-Hershko  
> [http://code972.com](http://code972.com) | @synhershko [https://twitter.com/synhershko](https://twitter.com/synhershko)  
> Freelance Developer & Consultant  
> Author of RavenDB in Action [http://manning.com/synhershko/](http://manning.com/synhershko/)
> 
> On Mon, May 5, 2014 at 4:18 PM, Marcio Rodrigues \<[marsh...@gmail.com](mailto:marsh...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Hi
> > 
> > Hoping there are some nest users here who could help me out.
> > 
> > I am trying to figure out how to specify cutom field analyzers on a Poco  
> > class , so that when it get's indexed automatically via Nest the fields  
> > will be appropriately anlyzed.
> > 
> > But I can't seem to find a way to specify a custom Analyzer for a field  
> > in a Poco ( have searched the documentation as well and not found any help)  
> > Is this possible , or do I have to do the mappings manually before?
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/293cc2c5-2f23-4698-85b7-309fb15de9b9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/293cc2c5-2f23-4698-85b7-309fb15de9b9%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/293cc2c5-2f23-4698-85b7-309fb15de9b9%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/293cc2c5-2f23-4698-85b7-309fb15de9b9%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/8c9a526a-6153-4291-a94c-35ea0d14240a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8c9a526a-6153-4291-a94c-35ea0d14240a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Itamar\_Syn\_Hershko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/itamar_syn_hershko/32/725_2.png) [@Itamar\_Syn\_Hershko](https://discuss.elastic.co/u/Itamar_Syn_Hershko)\
**Post date:** [May 5, 2014, 4:51pm UTC](https://discuss.elastic.co/t/nest-custom-analyser/17349/4 "2014-05-05T16:51:16Z")

</div>

It would have to be defined on ES, the analyzer name has to be the one that  
ES recognizes (as the plugin defines it)

--

Itamar Syn-Hershko  
[http://code972.com](http://code972.com) | @synhershko [https://twitter.com/synhershko](https://twitter.com/synhershko)  
Freelance Developer & Consultant  
Author of RavenDB in Action [http://manning.com/synhershko/](http://manning.com/synhershko/)

On Mon, May 5, 2014 at 7:50 PM, Marcio Rodrigues [marshy1001@gmail.com](mailto:marshy1001@gmail.com)wrote:

> Thanks Itamar
> 
> Would "my\_analyzer" in this case be an analyzer i defined in code myself  
> or would it have to have been already created in ES?
> 
> On Monday, May 5, 2014 5:44:18 PM UTC+1, Itamar Syn-Hershko wrote:
> 
> > This should work:
> > 
> > ```
> > [ElasticProperty(Analyzer = "my_analyzer")]
> > public string Content { get; set;}
> > 
> > ```
> > 
> > You can also specify Index/SearchAnalyzer this way (for fine-grained  
> > control)
> > 
> > --
> > 
> > Itamar Syn-Hershko  
> > [http://code972.com](http://code972.com) | @synhershko [https://twitter.com/synhershko](https://twitter.com/synhershko)  
> > Freelance Developer & Consultant  
> > Author of RavenDB in Action [http://manning.com/synhershko/](http://manning.com/synhershko/)
> > 
> > On Mon, May 5, 2014 at 4:18 PM, Marcio Rodrigues [marsh...@gmail.com](mailto:marsh...@gmail.com)wrote:
> > 
> > > Hi
> > > 
> > > Hoping there are some nest users here who could help me out.
> > > 
> > > I am trying to figure out how to specify cutom field analyzers on a Poco  
> > > class , so that when it get's indexed automatically via Nest the fields  
> > > will be appropriately anlyzed.
> > > 
> > > But I can't seem to find a way to specify a custom Analyzer for a field  
> > > in a Poco ( have searched the documentation as well and not found any help)  
> > > Is this possible , or do I have to do the mappings manually before?
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > 
> > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > msgid/elasticsearch/293cc2c5-2f23-4698-85b7-309fb15de9b9%  
> > > [40googlegroups.com](http://40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/293cc2c5-2f23-4698-85b7-309fb15de9b9%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/293cc2c5-2f23-4698-85b7-309fb15de9b9%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/8c9a526a-6153-4291-a94c-35ea0d14240a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8c9a526a-6153-4291-a94c-35ea0d14240a%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/8c9a526a-6153-4291-a94c-35ea0d14240a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/8c9a526a-6153-4291-a94c-35ea0d14240a%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAHTr4ZtD89TDMhPovRLobbPduK4iNYzbvHQUbMxOQrsjLYHBhA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHTr4ZtD89TDMhPovRLobbPduK4iNYzbvHQUbMxOQrsjLYHBhA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Marcio\_Rodrigues](https://avatars.discourse-cdn.com/v4/letter/m/df705f/32.png) [@Marcio\_Rodrigues](https://discuss.elastic.co/u/Marcio_Rodrigues)\
**Post date:** [May 5, 2014, 5:19pm UTC](https://discuss.elastic.co/t/nest-custom-analyser/17349/5 "2014-05-05T17:19:08Z")

</div>

Ah ok, so if i undesratd correctly, there is no way to define a custom  
analyser in code and use that to to index a poco?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/69b6c529-3e55-472e-92e0-79c4c2f01ce4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/69b6c529-3e55-472e-92e0-79c4c2f01ce4%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Itamar\_Syn\_Hershko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/itamar_syn_hershko/32/725_2.png) [@Itamar\_Syn\_Hershko](https://discuss.elastic.co/u/Itamar_Syn_Hershko)\
**Post date:** [May 5, 2014, 5:25pm UTC](https://discuss.elastic.co/t/nest-custom-analyser/17349/6 "2014-05-05T17:25:40Z")

</div>

There are 2 ways to define a custom analyzer - one is via configuration  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/custom-analyzers.html),  
and the other is via code.

If your custom analyzer is written in code, it will be Java code that has  
to be deployed to ES as a plugin while your code is a client written in  
.NET, so no

Otherwise, you can define the analyzer via index settings from client code  
as well

--

Itamar Syn-Hershko  
[http://code972.com](http://code972.com) | @synhershko [https://twitter.com/synhershko](https://twitter.com/synhershko)  
Freelance Developer & Consultant  
Author of RavenDB in Action [http://manning.com/synhershko/](http://manning.com/synhershko/)

On Mon, May 5, 2014 at 8:19 PM, Marcio Rodrigues [marshy1001@gmail.com](mailto:marshy1001@gmail.com)wrote:

> Ah ok, so if i undesratd correctly, there is no way to define a custom  
> analyser in code and use that to to index a poco?
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/69b6c529-3e55-472e-92e0-79c4c2f01ce4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/69b6c529-3e55-472e-92e0-79c4c2f01ce4%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/69b6c529-3e55-472e-92e0-79c4c2f01ce4%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/69b6c529-3e55-472e-92e0-79c4c2f01ce4%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAHTr4Zu7wqg9unpmjM%2BHrcY8OPUPGeXXQ84mzCFCVpp3W%3DkYmA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHTr4Zu7wqg9unpmjM%2BHrcY8OPUPGeXXQ84mzCFCVpp3W%3DkYmA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Marcio\_Rodrigues](https://avatars.discourse-cdn.com/v4/letter/m/df705f/32.png) [@Marcio\_Rodrigues](https://discuss.elastic.co/u/Marcio_Rodrigues)\
**Post date:** [May 6, 2014, 9:17am UTC](https://discuss.elastic.co/t/nest-custom-analyser/17349/7 "2014-05-06T09:17:49Z")

</div>

Thanks, I know the other ways of doing it, I was more specifically  
interested in doing it on a field within a Poco via the NEST api.

On Monday, May 5, 2014 6:25:40 PM UTC+1, Itamar Syn-Hershko wrote:

> There are 2 ways to define a custom analyzer - one is via configuration  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/custom-analyzers.html), and the other is via code.
> 
> If your custom analyzer is written in code, it will be Java code that has  
> to be deployed to ES as a plugin while your code is a client written in  
> .NET, so no
> 
> Otherwise, you can define the analyzer via index settings from client code  
> as well
> 
> --
> 
> Itamar Syn-Hershko  
> [http://code972.com](http://code972.com) | @synhershko [https://twitter.com/synhershko](https://twitter.com/synhershko)  
> Freelance Developer & Consultant  
> Author of RavenDB in Action [http://manning.com/synhershko/](http://manning.com/synhershko/)
> 
> On Mon, May 5, 2014 at 8:19 PM, Marcio Rodrigues \<[marsh...@gmail.com](mailto:marsh...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Ah ok, so if i undesratd correctly, there is no way to define a custom  
> > analyser in code and use that to to index a poco?
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/69b6c529-3e55-472e-92e0-79c4c2f01ce4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/69b6c529-3e55-472e-92e0-79c4c2f01ce4%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/69b6c529-3e55-472e-92e0-79c4c2f01ce4%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/69b6c529-3e55-472e-92e0-79c4c2f01ce4%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/7f19491d-aad3-45be-8ade-0518f2695ef0%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7f19491d-aad3-45be-8ade-0518f2695ef0%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:31am UTC](https://discuss.elastic.co/t/nest-custom-analyser/17349/8 "2017-07-06T01:31:29Z")

</div>


