I am trying to search for a particular element within an array through a term, but when querying, I get nothing p.s: I am using elasticsearch 7.x.
I created the following query:
POST spring/_search
{
"query": {
"nested": {
"path": "paragrafos",
"score_mode": "avg",
"query": {
"bool": {
"must": {
"match": {
"paragrafos.conteudo": """4 | Chapter 1: Terms\r?\n"""
}
}
}
}
}
}
}
my mapping is:
PUT spring/
{
"mappings": {
"properties": {
"downloadUrl": {
"type": "text",
"fielddata": true,
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"nome": {
"type": "text",
"fielddata": true,
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"paginas": {
"type": "nested",
"properties": {
"numeroPagina": {
"type": "long"
},
"paragrafos": {
"type": "long"
}
}
},
"paragrafos": {
"type": "nested",
"properties": {
"conteudo": {
"type": "text",
"fielddata": true,
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"paginaNumero": {
"type": "long"
}
}
}
}
}
}
and my data is:
"id" : null,
"nome" : "BigData",
"downloadUrl" : "https://jdjscm.s3-us-west-2.amazonaws.com/teste/LEITE%2C+Carlos+Henrique+Bezerra.+Curso+de+Direito+Processual+do+Trabalho+(2015).pdf",
"paginas": [],
"paragrafos": [{"conteudo":"data", "paginaNumero": 5}, {"conteudo":"test", "paginaNumero": 6}, {"conteudo":"view", "paginaNumero": 7}
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 0,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
}
}
Is there an error in my query?
Is there an error in my query?
I've tested with filtered and filter, but returns all unfiltered objects;