ElasticSearch索引键/值映射

时间:2018-01-24 15:50:32

标签: java elasticsearch elasticsearch-plugin spring-data-elasticsearch

我在我的java项目中使用elasticsearch作为索引引擎。我问是否有索引java.util.Map的键/值Map。

例如我有这个java类:

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;
 ...
}

我想创建一个包含元数据Map变量的elasticsearch映射。这样的事情:

 {
    "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"
                        }
                    }
                }
            }
        }
    }
}

0 个答案:

没有答案
相关问题