问题
I'm using elasticsearch as indexing engine in my java project. I'm asking if there is anyway to index a java.util.Map a key/value Map.
For example i have this java class:
public class NextEvent extends NewtonResource{
private Map<String, String> metadata;
private Instant executionDate;
private String type;
protected Boolean executed;
private List<PatchOperation> jsonPatch;
private List<String> crons;
...
}
I want to create an elasticsearch mapping including the Map of metadata variable. somethings like this:
{
"aliases": {
"posc-alias-nextevent": {}
},
"mappings": {
"nextevent": {
"properties": {
"executed": {
"type": "boolean"
},
"executionDate": {
"type": "date"
},
"type": {
"type": "string",
"index": "not_analyzed"
},
"metadata": {
"type": "nested",
"properties": {
"key": {
"type": "string",
"index": "not_analyzed"
},
"value": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}
}
来源:https://stackoverflow.com/questions/48426474/elasticsearch-indexing-key-value-map