0

I have products index with mapping

"synonym" : {
    "type" : "synonym",
    "synonyms" : [
        "netbook => laptop"
    ]
}

I want to search my products by query "lapt*" or "netb*"

1 Answers1

2

If searching by lapt* works but not netb* then you need to change your synonyms filter to this (i.e. replace => by a comma):

"synonym" : {
    "type" : "synonym",
    "synonyms" : [
        "netbook, laptop"
    ]
}

Using => replaces netbook by laptop and hence only the latter is indexed. Using a comma, will index both netbook and laptop and allow you to search for prefixes with both netb* and lapt*

Val
  • 207,596
  • 13
  • 358
  • 360