有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java ElasticSearch索引键/值映射

我在java项目中使用elasticsearch作为索引引擎。我想问的是,是否有任何方法可以索引java。util。映射键/值映射

例如,我有一个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;
 ...
}

我想创建一个包含元数据变量映射的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) 个答案