Just to let things clear, first day working with Elastic... Moving to the problem.
I started to create my index with
curl -XPUT "http://localhost:9200/users" -d'
{
"mappings": {
"user": {
"properties": {
"education": {
"type": "nested"
},
"job": {
"type": "nested"
}
}
}
}
}'
and then
curl -XPOST "http://localhost:9200/users/user/" -d'
{
"name": "User A",
"education": [
{
"school": "School A1",
"course": "Course A1"
},
{
"school": "School A2",
"course": "Course A2"
}
]
}'
The problem that I'm facing now is the query part. I'm trying to get results with:
curl -XPOST "http://localhost:9200/users/user/_search?pretty" -d'
{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"nested": {
"path": "education",
"filter": {
"bool": {
"must": [
{
"term": {
"education.school": "School A1"
}
}
]
}
}
}
}
}
}
}'
But nothing is getting returned.
educationfield with valueSchool Aanalysed Stringstandard analyserwill be applied on all Strings. Have provided an answer. Please see if it works for you