I have a sample data that includes data from univerities, schools and dormitories. I want to use this data in Elasticsearch. I send the body as follows when making filteration:
Sample Data:
[
{
name: 'Maisha school of sience',
school_type: 'public',
location: 'A',
},
{
name: 'Maisha elementry school',
school_type: 'private',
location: 'B',
},
{
name: 'istanbul university',
university_type: 'public',
location: 'C',
},
{
name: 'Maisha university',
university_type: 'private',
location: 'D',
},
{
name: 'kbb center of Maisha',
dormitory_type: 'public',
location: 'E',
},
{
name: 'high Maisha dorm',
dormitory_type: 'private',
location: 'F',
},
]
My Query:
"query": {
"bool": {
"must": [
{
"query_string": {
"query": "*Maisha*",
"fields": [
"name"
]
}
},
{
"match": {
"school_type": "public"
}
}
]
}
}
Result:
{
name: 'Maisha school of sience',
school_type: 'public',
location: 'A',
}
This result actually makes sence because it gives the exact result but dormitory and university data are not shown which is the main problem. In other words, I only want the school_type to be public but why it filters out and not showing university and dormitory data?