Multi text search in same field

Hi,

How can we search multi text content in same field.

for example i have language field, i want to fetch multiple languages data like english , tamil, hindi

below is my code version 5.1.1

{
"query": {
"bool": {
"must": {
"term": {
"parent_cat": "6"
}
},
"should": [
{
"term": {
"lang": "T"
}
},
{
"term": {
"lang": "en"
}
}
],
"must_not": {
"term": {
"feed_url_status": "0"
}
}
}
}
}

same process i had done this in version 2.1.1 , it is working fine. below is the code of it.

{
"query": {
"filtered": {
"query": {
"query_string": {
"query": "6",
"fields": [
"parent_cat"
]
}
},
"filter": {
"bool": {
"should": [
{
"term": {
"lang": "T"
}
},
{
"term": {
"lang": "en"
}
}
],
"must_not": {
"term": {
"feed_url_status": "0"
}
}
}
}
}
}
}

Thanks

Thanigaivelan

As of ES 5.x you can now add a filter clause to a bool query: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html

So to migrate your 2.1.1 query, you should make a filter clause that is another bool containing your should language terms.

Mike McCandless

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