-
-
Save imotov/737176fd5a0f60730db8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XDELETE localhost:9200/test-idx | |
curl -XPUT localhost:9200/test-idx -d '{ | |
"mappings": { | |
"ofertas": { | |
"properties": { | |
"idtipooa": { | |
"type": "nested", | |
"properties": { | |
"nombre": {"type": "string", "index": "not_analyzed" } | |
} | |
} | |
} | |
} | |
} | |
}' | |
echo | |
curl -XPUT localhost:9200/test-idx/ofertas/3 -d '{ | |
"id": 3, | |
"nombreoa": "Abogacia", | |
"titulo": "Abogado", | |
"idtipooa": { | |
"nombre": "Carrera Universitaria" | |
} | |
}' | |
echo | |
curl -XPOST localhost:9200/test-idx/_refresh | |
echo | |
echo | |
echo '== Searching for "Universitaria" - no results ==' | |
curl -XPOST "localhost:9200/test-idx/ofertas/_search?pretty=true" -d '{ | |
"query": { | |
"filtered": { | |
"query": { | |
"match_all": {} | |
}, | |
"filter": { | |
"nested": { | |
"path": "idtipooa", | |
"query": { | |
"bool": { | |
"must": [{ | |
"match": { | |
"idtipooa.nombre": "Universitaria" | |
} | |
}] | |
} | |
}, | |
"_cache": true | |
} | |
} | |
} | |
} | |
}' | |
echo | |
echo | |
echo '== Searching for "Carrera Universitaria" - one result ==' | |
curl -XPOST "localhost:9200/test-idx/ofertas/_search?pretty=true" -d '{ | |
"query": { | |
"filtered": { | |
"query": { | |
"match_all": {} | |
}, | |
"filter": { | |
"nested": { | |
"path": "idtipooa", | |
"query": { | |
"bool": { | |
"must": [{ | |
"match": { | |
"idtipooa.nombre": "Carrera Universitaria" | |
} | |
}] | |
} | |
}, | |
"_cache": true | |
} | |
} | |
} | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Finally I got it. The mapping was wrong. It should be like that: