Defining a list of strings as synonyms for a multiword string

I want to provide variations of field "title" as its synonyms. I expect that if a user searches for the exact title or any of its variations, this particular document should be returned as first.

eg. I have many faq documents. one of those is

below is the required faq with its synonymous questions


I read about complexities that arise in case of multi word synonyms. Can anybody suggest how can I map all those question variations as equivalent to the actual question and referring to the same document.

One of the solutions that I though of as adding all ques variations as another property field in my index and while querrying using query more_like_this providing title(here it refers to actual title of question faq) and ques variations list.

below is my code for indexing, ingested data and querying
PUT faq
{
"mappings": {
"articles": {
"properties": {
"title": {
"type": "string"
},
"ques_var": {
"type": "string"
},
"detail": {
"type": "string"
},
"detail_html": {
"type": "string"
},
"account_id": {
"type": "long"
}
}
}
}
}

Here my "title" would be "How to log in into facebook?"
my "ques_var" would be ["facebook login?", "where to login for facebook", "do i need to sign up for logging into facebook"]

and my query is like this below:

eq.query(Query.more_like_this([constants.TITLE, constants.QUES_VAR], input_data[
constants.QUERY],
min_term_freq=options.faq_min_term_freq,
min_doc_freq=options.faq_min_doc_freq))

kindly suggest me if this approach is right

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.