Skip to content

Instantly share code, notes, and snippets.

@shantanuo
Created May 4, 2020 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shantanuo/57976612efdc326c5d9c85965a86bb11 to your computer and use it in GitHub Desktop.
Save shantanuo/57976612efdc326c5d9c85965a86bb11 to your computer and use it in GitHub Desktop.
elasticsearch commands for better search results of marathi shabdakosh
DELETE bruhadkosh/
PUT bruhadkosh
{ "mappings": {
"properties": {
"kosh": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
}
}
POST bruhadkosh/_doc
{"kosh":"पापणीपूजक पु. प्रार्थनासमाजी; प्रार्थना करताना हे डोळे मिटतात. 'आम्ही पापणी पूज़क नाहीं असें लिहून देणा- रांनीं गणपती उत्सवास सहाय्य कां करूं नये.' -टिच १.४२४. [पापणी + पूजक]"}
POST bruhadkosh/_doc
{"kosh":"सोनें न. १ कांचन; सुवर्ण; पिवळ्या रंगाची जड व मोल- वान अशी एक धातु. २ दसर्‍याचे दिवशीं सीमोल्लंघन करून आल्यावर इष्टमित्रांस देण्यासाठीं आणलेलीं आपट्याचीं पानें. त्यावरून एखादें महत्कृत्य घडवून आणण्यांत महत्त्वाच्या गोष्टीं प्रमाणें अनुषंगिक गोष्टींचेंहि सहाय्य होणें, थोराप्रमाणें हलक्या- चेंहि सहाय्य लागणें. "}
POST bruhadkosh/_doc
{"kosh":"योगदान न. सहाय्य; मदत. 'पुष्कलशी भक्तमंडळी तुम्हांस या कामी योगदान देतील.' -गौरांगऊ [सं. युज्- योग + दा-दान]"}
POST bruhadkosh/_doc
{"kosh":"टाळू स्त्री. १ डोक्याचा वरील पुढचा भाग; मस्तकाग्र; कवटी. २ टाळूवर ठेवलेले केंस. ३ तालुप्रदेश; तोंडाच्या वरच्या जबड्याचा आंतील भाग."}
GET bruhadkosh/_search
{
"query": {
"bool": {
"must": [
{
"function_score": {
"query": {
"match": {
"kosh": "सहाय्य"
}
},
"script_score": {
"script": """
def pos = doc['kosh.keyword'].value.indexOf('सहाय्य');
return Math.exp((2.0/(pos+1)))
"""
},
"boost_mode": "replace"
}
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment