Using the synonyms while using the _search "method"

This is something I was unable to find out in the manual.
I have made some synonyms but I was unable to make it work so that when I
search for something those synonyms are used in the search and are added to
the search parameters

For example, if I add some synonyms to the file and then use the _analize
API such that it includes the synonyms it find the synonyms properly but it
does not give my any advice about how to replace them so I can't use that
to enrich my search.
How do I use the synonym system for searching?
Here's an example of what I want:
If I search for:
"+random +string I wanted to +give"
And string and sentence are synonyms, then it would search for:
"+random +(string OR sentence) I wanted to +give" (or equivalent)

How do I do that?

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

The query method you describe is query expansion. Query expansion is the
process of adding terms to a query before it is submitted for search.

Query expansion is not specific to Elasticsearch, it can be implemented in
any search UI. Elasticsearch is expanding the index when using synonyms. As
a result, the index is larger but synonyms are not required to be given in
the query.

If you want query expansion, you could write a plugin for managing synonyms
by your custom method.

Note that index expansion has advantages over query expansion. The
searching is faster.

Jörg
Am 13.10.2013 15:23 schrieb "bruno ais" brunoaiss@gmail.com:

This is something I was unable to find out in the manual.
I have made some synonyms but I was unable to make it work so that when I
search for something those synonyms are used in the search and are added to
the search parameters

For example, if I add some synonyms to the file and then use the _analize
API such that it includes the synonyms it find the synonyms properly but it
does not give my any advice about how to replace them so I can't use that
to enrich my search.
How do I use the synonym system for searching?
Here's an example of what I want:
If I search for:
"+random +string I wanted to +give"
And string and sentence are synonyms, then it would search for:
"+random +(string OR sentence) I wanted to +give" (or equivalent)

How do I do that?

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Is there a way to request a reindex to elasticsearch when the synonyms
are changed?

On 13-10-2013 14:41, joergprante@gmail.com wrote:

The query method you describe is query expansion. Query expansion is
the process of adding terms to a query before it is submitted for search.

Query expansion is not specific to Elasticsearch, it can be
implemented in any search UI. Elasticsearch is expanding the index
when using synonyms. As a result, the index is larger but synonyms are
not required to be given in the query.

If you want query expansion, you could write a plugin for managing
synonyms by your custom method.

Note that index expansion has advantages over query expansion. The
searching is faster.

Jörg

Am 13.10.2013 15:23 schrieb "bruno ais" <brunoaiss@gmail.com
mailto:brunoaiss@gmail.com>:

This is something I was unable to find out in the manual.
I have made some synonyms but I was unable to make it work so that
when I search for something those synonyms are used in the search
and are added to the search parameters

For example, if I add some synonyms to the file and then use the
_analize API such that it includes the synonyms it find the
synonyms properly but it does not give my any advice about how to
replace them so I can't use that to enrich my search.
How do I use the synonym system for searching?
Here's an example of what I want:
If I search for:
"+random +string I wanted to +give"
And string and sentence are synonyms, then it would search for:
"+random +(string OR sentence) I wanted to +give" (or equivalent)

How do I do that?
-- 
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%2Bunsubscribe@googlegroups.com>.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/UW4jL3IUXbs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Ok, I got it now.
1st:
It seems like it is not doing index expansion. When I start an index with a
synonyms file and then I store some information in it, if I do a boolean
query search it is not matching the synonyms.
E.g. I have a synonym:
aaafoo => aaabar

So I expect when there's aaafoo I get aaafoo and aaabar (both) indexed.
When I search for aaafoo I don't get the result. (I also tried searching
for aaabar and trying to get the aaafoo result to test it out).
Could it be that I'm doing something wrong int he way?
Query JSON:
{
"query": {
"bool": {
"must": [
{
"term": {
"search.searched": "aaafoo"
}
}
]
}
}
}

By the way, Is there a way to request a reindex to elasticsearch when the
synonyms are changed?

On Sunday, October 13, 2013 10:19:22 PM UTC+1, bruno ais wrote:

On 13-10-2013 14:41, joergprante@gmail.com wrote:

The query method you describe is query expansion. Query expansion is the
process of adding terms to a query before it is submitted for search.

Query expansion is not specific to Elasticsearch, it can be implemented in
any search UI. Elasticsearch is expanding the index when using synonyms. As
a result, the index is larger but synonyms are not required to be given in
the query.

If you want query expansion, you could write a plugin for managing
synonyms by your custom method.

Note that index expansion has advantages over query expansion. The
searching is faster.

Jörg
Am 13.10.2013 15:23 schrieb "bruno ais" brunoaiss@gmail.com:

This is something I was unable to find out in the manual.
I have made some synonyms but I was unable to make it work so that when I
search for something those synonyms are used in the search and are added to
the search parameters

For example, if I add some synonyms to the file and then use the _analize
API such that it includes the synonyms it find the synonyms properly but it
does not give my any advice about how to replace them so I can't use that
to enrich my search.
How do I use the synonym system for searching?
Here's an example of what I want:
If I search for:
"+random +string I wanted to +give"
And string and sentence are synonyms, then it would search for:
"+random +(string OR sentence) I wanted to +give" (or equivalent)

How do I do that?

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.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/UW4jL3IUXbs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

You should use analyze API to understand what elasticsearch is doing behind the scene: Elasticsearch Platform — Find real-time answers at scale | Elastic

You will see what tokens produce your analyzer.

By the way, Is there a way to request a reindex to elasticsearch when the synonyms are changed?
You have to reindex yourself.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 13 oct. 2013 à 23:47, bruno ais brunoaiss@gmail.com a écrit :

Ok, I got it now.
1st:
It seems like it is not doing index expansion. When I start an index with a synonyms file and then I store some information in it, if I do a boolean query search it is not matching the synonyms.
E.g. I have a synonym:
aaafoo => aaabar

So I expect when there's aaafoo I get aaafoo and aaabar (both) indexed.
When I search for aaafoo I don't get the result. (I also tried searching for aaabar and trying to get the aaafoo result to test it out).
Could it be that I'm doing something wrong int he way?
Query JSON:
{
"query": {
"bool": {
"must": [
{
"term": {
"search.searched": "aaafoo"
}
}
]
}
}
}

By the way, Is there a way to request a reindex to elasticsearch when the synonyms are changed?

On Sunday, October 13, 2013 10:19:22 PM UTC+1, bruno ais wrote:

On 13-10-2013 14:41, joergprante@gmail.com wrote:
The query method you describe is query expansion. Query expansion is the process of adding terms to a query before it is submitted for search.

Query expansion is not specific to Elasticsearch, it can be implemented in any search UI. Elasticsearch is expanding the index when using synonyms. As a result, the index is larger but synonyms are not required to be given in the query.

If you want query expansion, you could write a plugin for managing synonyms by your custom method.

Note that index expansion has advantages over query expansion. The searching is faster.

Jörg

Am 13.10.2013 15:23 schrieb "bruno ais" brunoaiss@gmail.com:

This is something I was unable to find out in the manual.
I have made some synonyms but I was unable to make it work so that when I search for something those synonyms are used in the search and are added to the search parameters

For example, if I add some synonyms to the file and then use the _analize API such that it includes the synonyms it find the synonyms properly but it does not give my any advice about how to replace them so I can't use that to enrich my search.
How do I use the synonym system for searching?
Here's an example of what I want:
If I search for:
"+random +string I wanted to +give"
And string and sentence are synonyms, then it would search for:
"+random +(string OR sentence) I wanted to +give" (or equivalent)

How do I do that?

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.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elasticsearch/UW4jL3IUXbs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Please post a sequence of your commands so it can be reproduced, it is not
easy to find out what you are working on.

You have illustrated a "term" search which is probably the reason for
missed hits because normally an analyzer is used, for this, a "match" query
is preferred.

For a working synonym example and a demonstration of index expansion, see

Jörg

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Thank you Jörg Prante.
Your example has shown me what I was doing wrong.

Also, sorry you two. I forgot to make you an example but anyway, my case
was quite simple and you were able to show me my mistake with the example.
Thank you

On Monday, October 14, 2013 12:43:23 AM UTC+1, Jörg Prante wrote:

Please post a sequence of your commands so it can be reproduced, it is not
easy to find out what you are working on.

You have illustrated a "term" search which is probably the reason for
missed hits because normally an analyzer is used, for this, a "match" query
is preferred.

For a working synonym example and a demonstration of index expansion, see
Synonym example with Elasticsearch · GitHub

Jörg

--
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.
For more options, visit https://groups.google.com/groups/opt_out.