# How to add a synonym set at indexing

**URL:** <https://discuss.elastic.co/t/how-to-add-a-synonym-set-at-indexing/380973>\
**Category:** Elasticsearch\
**Created:** [August 12, 2025, 6:22pm UTC](https://discuss.elastic.co/t/how-to-add-a-synonym-set-at-indexing/380973 "2025-08-12T18:22:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![VeniVidiVici](https://avatars.discourse-cdn.com/v4/letter/v/50afbb/32.png) [@VeniVidiVici](https://discuss.elastic.co/u/VeniVidiVici)\
**Post date:** [August 12, 2025, 6:22pm UTC](https://discuss.elastic.co/t/how-to-add-a-synonym-set-at-indexing/380973/1 "2025-08-12T18:22:19Z")

</div>

Hello,

I’m struggling to add a synonym at indexing using the EalsticSearch C# API, does anyone here has an example by any chance? My understanding is that I have to run the synonym association after I create my index. I close my index and then I try to run:

> var putSynonymResponse = await client.Synonyms.PutSynonymAsync(  
> "my-synonym-set",  
> new PutSynonymSetRequest  
> {  
> SynonymsSet = new List  
> {  
> new() { Id = "rule-1", Synonyms = "foo, bar" }  
> }  
> }  
> );

But PutSynonymSetRequest is not defined. What am I doing wrong?

Thank you !!!
