Hello Luiz, thank you for your reply!
As we use rivers, I was told to declare the analyzer there.
It looks like this for me:
{
"index" : {
"analysis" : {
"filter" : {
"synonym_filter" : {
"type" : "synonym",
"synonyms" : [
"foo, foo bar => core"
]
}
},
"analyzer" : {
"synonym" : {
"tokenizer" : "whitespace",
"filter" : [
"synonym_filter"
],
"type" : "custom",
}
}
}
}
}
which acctually says, for testing-purpose, 'if someone searches for 'foo'
or 'foo bar', search for 'core' '
Now my query uses the analyzer:
{
"query": {
"bool": {
"should": [
{
"multi_match": {
"query": "foo",
"fields": [
"TITLE",
"SHORTDESC"
],
"type": "phrase_prefix",
"analyzer": "synonym"
}
},
{
"multi_match": {
"query": "foo",
"cutoff_frequency": null,
"fields": [
"TITLE",
"SHORTDESC"
]
}
}
]
}
},
"filter": {
"term": {
"ACTIVE": 1
}
},
"sort": {
"TITLE": {
"order": "asc"
}
},
"size": 7
}
But I get an error there:
[...]nested: QueryParsingException[[test484] [multi_match] analyzer
[synonym] not found];[...]
What am I doing wrong here?
Am Montag, 7. April 2014 09:29:17 UTC+2 schrieb Alex K:
>
> Hello there,
>
> i have a query, example is this:
> {
> "query": {
> "bool": {
> "should": [
> {
> "multi_match": {
> "query": "foo",
> "fields": [
> "TITLE",
> "SHORTDESC"
> ],
> "type": "phrase_prefix"
> }
> },
> {
> "multi_match": {
> "query": "foo",
> "cutoff_frequency": null,
> "fields": [
> "TITLE",
> "SHORTDESC"
> ]
> }
> }
> ]
> }
> },
> "filter": {
> "term": {
> "ACTIVE": 1
> }
> },
> "sort": {
> "TITLE": {
> "order": "asc"
> }
> },
> "size": 7
> }
>
> Now I have the question if I can use synonyms here?
>
> I already saw that you can use a synonym-token inside an analyzer.
> But I have a query here, not an analyzer.
> Do I have to put an analyzer inside the query?
>
> I don't know much about ES yet, so this may be a total stupid question.
> Thank you in advance :-)
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/3ec9e97d-f210-4a88-a269-f6306bf0266c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.