# Synonym token recovery

**URL:** <https://discuss.elastic.co/t/synonym-token-recovery/6987>\
**Category:** Elasticsearch\
**Created:** [March 14, 2012, 12:05am UTC](https://discuss.elastic.co/t/synonym-token-recovery/6987 "2012-03-14T00:05:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stratawing](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@stratawing](https://discuss.elastic.co/u/stratawing)\
**Post date:** [March 14, 2012, 12:05am UTC](https://discuss.elastic.co/t/synonym-token-recovery/6987/1 "2012-03-14T00:05:38Z")

</div>

I asked this a few days ago and got zero responses -- so I'll ask it  
again. Note that a response that says "you're a total idiot -- this  
isn't possible" is fine -- just need to get a sense of whether this is  
possible or not. So here's the question:

Is there any way to return the actual tokens generated by an  
index\_analyzer at search time? I am using the synonyms filter  
(without expansion) to index a particular field, and would like to  
get  
the standardized value (right-hand-side of the "=\>" in my synonyms  
file ) for each document that was retrieved.

synonym file includes, for example:

i-pod, i pod =\> ipod,

when user searches for "i-pod" or "i pod", I want to return the  
indexed doc, but also want to return "ipod" as the token that was  
created at index time as part of the analysis.  
I have my synonyms analyzer up and running, and can get the proper  
tokens using the Analyze API.

Many thanks in advance for your thoughts and time.

Cheers!

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [March 14, 2012, 12:29pm UTC](https://discuss.elastic.co/t/synonym-token-recovery/6987/2 "2012-03-14T12:29:07Z")

</div>

I posted it on the other question (just now) :), but just mention it here as well, you can use the analyze API to get the generated tokens.

On Wednesday, March 14, 2012 at 2:05 AM, stratawing wrote:

> I asked this a few days ago and got zero responses -- so I'll ask it  
> again. Note that a response that says "you're a total idiot -- this  
> isn't possible" is fine -- just need to get a sense of whether this is  
> possible or not. So here's the question:
> 
> Is there any way to return the actual tokens generated by an  
> index\_analyzer at search time? I am using the synonyms filter  
> (without expansion) to index a particular field, and would like to  
> get  
> the standardized value (right-hand-side of the "=\>" in my synonyms  
> file ) for each document that was retrieved.
> 
> synonym file includes, for example:
> 
> i-pod, i pod =\> ipod,
> 
> when user searches for "i-pod" or "i pod", I want to return the  
> indexed doc, but also want to return "ipod" as the token that was  
> created at index time as part of the analysis.  
> I have my synonyms analyzer up and running, and can get the proper  
> tokens using the Analyze API.
> 
> Many thanks in advance for your thoughts and time.
> 
> Cheers!

---

<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, 3:36am UTC](https://discuss.elastic.co/t/synonym-token-recovery/6987/3 "2017-07-06T03:36:11Z")

</div>


