Skip to content

Commit 0576fd3

Browse files
authored
Merge pull request #484 from hellohaptik/support_for_new_lang
changing term query to match query for get request, elastic search to support text search.
2 parents 3175cc0 + bc93a8f commit 0576fd3

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

datastore/elastic_search/query.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -598,13 +598,18 @@ def get_crf_data_for_entity_name(connection, index_name, doc_type, entity_name,
598598
}
599599
}
600600
}
601-
601+
# match query does not support array(list of languages).
602+
# building a list of dictionaries corresponding to match query for each language
602603
if languages:
603-
data['query']['bool']['filter'] = {
604-
"terms": {
605-
"language_script": languages
604+
list_query_langs = []
605+
for lang in languages:
606+
query_lang = {
607+
"match": {
608+
"language_script": lang
609+
}
606610
}
607-
}
611+
list_query_langs.append(query_lang)
612+
data['query']['bool']['should'] = list_query_langs
608613

609614
kwargs = dict(kwargs,
610615
body=data,

0 commit comments

Comments
 (0)