1
elastic4sを使用して_sourceですべてのフィールド名(値ではない)を取得するにはどうすればよいですか?マップされたすべてのフィールドのリストが必要です。 私のような何かをやってみました:elasticsearchですべてのフィールドを取得する方法
search in indexName/indexType sourceInclude "_source" limit q.limit aggregations(
aggregation terms "agg0" field "_field_names" size 0
)
あるいは
search in indexName/indexType sourceInclude "_source" sourceExclude ("_all", "_type",
"_uid", "_version", "_index", "_score", "_id") limit q.limit aggregations(
aggregation terms "agg0" field "_field_names" size 0
)
が、それはそれをしませんでした。私は、すべてのメタデータフィールドを持っていないだけで、それらの
"aggregations" : {
"agg0" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [ {
"key" : "_all",
"doc_count" : 1500
}, {
"key" : "_source",
"doc_count" : 1500
}, {
"key" : "_type",
"doc_count" : 1500
}, {
"key" : "_uid",
"doc_count" : 1500
}, {
"key" : "_version",
"doc_count" : 1500
}
.. more fields
_source下
に====アップデートを===
私はこの方法を見つけた:
val map = getMapping indexName /indexType}
val y = map.get("properties").asInstanceOf[java.util.Map[String, _]]
y.keys.toList
のためのより良い方法があります同じ結果が得られますか?
は、各文書のフィールドのリストをしたいですかそれともそれですか?タイプ全体で同じですか? 'getMapping(/)'を使用することができます。これはタイプごとに –
Pandawan
ありがとうございます。これは良いアプローチのようです。私の更新をチェックアウト – igx