エラスティック検索クラスターのクライアントとしてJava と Jest ( https://github.com/searchbox-io/Jest ) を使用しています。http://localhost:9200/myindex/mytypeで以下の構造を作成してインデックスを作成しようとしています
{
"doc": {
"_content": "mycontent",
"_name": "mypdf.pdf",
"_content_type": "application/pdf"
}
}
XContentBuilder docObject = jsonBuilder().startObject().field("_content", doc).field("_name", name).field("_content_type", contentType)
.field("title", title).field("author", author).endObject();
index1 = new Index.Builder(docObject).build();
source = jsonBuilder()
.startObject()
.field("doc", docObject.string())
.endObject().string();
Index index = new Index.Builder(source).index(baseIndexName).type(ElasticConstants.BASE_TYPE).build();
しかし、これが実行されると、ソースは Json として渡されず、キー「doc」の値は文字列リテラルとして渡されるため、インデックスが作成されません。Jest を使用して、ネストされた json オブジェクトを Index.Builder に渡すにはどうすればよいですか?