2016-04-18 14 views
0

私がしましたfuasタイプについて、このマッピング:集約は、ネストされた集計フィールドに失敗し

curl -XGET 'http://ESNode01:9201/living_team/fuas/_search?pretty' -d ' 
{ 
    "aggs" : { 
    "demo" : { 
     "nested" : { 
     "path" : "metainfos" 
     }, 
     "aggs" : { 
     "key" : { "terms" : { "field" : "metainfos.key" } } 
     } 
    } 
    } 
} 
' 

ESは私を実現:私はこの集計を実行しようとしている

curl -XGET 'http://localhost:9201/living_team/_mapping/fuas?pretty' 
{ 
    "living_v1" : { 
    "mappings" : { 
     "fuas" : { 
     "properties" : { 
      "backlogStatus" : { 
      "type" : "long" 
      }, 
      "comment" : { 
      "type" : "string" 
      }, 
      "dueTimestamp" : { 
      "type" : "date", 
      "format" : "strict_date_optional_time||epoch_millis" 
      }, 
      "matter" : { 
      "type" : "string" 
      }, 
      "metainfos" : { 
      "properties" : { 
       "category 1" : { 
       "type" : "string" 
       }, 
       "key" : { 
       "type" : "string" 
       }, 
       "null" : { 
       "type" : "string" 
       }, 
       "processos" : { 
       "type" : "string" 
       } 
      } 
      }, 
      "resources" : { 
      "properties" : { 
       "noteId" : { 
       "type" : "string" 
       }, 
       "resourceId" : { 
       "type" : "string" 
       } 
      } 
      }, 
      "status" : { 
      "type" : "long" 
      }, 
      "timestamp" : { 
      "type" : "date", 
      "format" : "strict_date_optional_time||epoch_millis" 
      }, 
      "user" : { 
      "type" : "string", 
      "index" : "not_analyzed" 
      } 
     } 
     } 
    } 
    } 
} 

"error" : { 
    "root_cause" : [ { 
     "type" : "aggregation_execution_exception", 
     "reason" : "[nested] nested path [metainfos] is not nested" 
    } ], 
    "type" : "search_phase_execution_exception", 
    "reason" : "all shards failed", 
    "phase" : "query_fetch", 
    "grouped" : true, 
    "failed_shards" : [ { 
     "shard" : 3, 
     "index" : "living_v1", 
     "node" : "HfaFBiZ0QceW1dpqAnv-SA", 
     "reason" : { 
     "type" : "aggregation_execution_exception", 
     "reason" : "[nested] nested path [metainfos] is not nested" 
     } 
    } ] 
    }, 
    "status" : 500 
} 

アイデア

答えて

0

あなたのmetainfosマッピングから"type":"nested"が見つかりません。

はされている必要があります:

"metainfos" : { 
    "type":"nested", 
    "properties" : { 
     "category 1" : { 
      "type" : "string" 
     }, 
     "key" : { 
      "type" : "string" 
     }, 
     "null" : { 
      "type" : "string" 
     }, 
     "processos" : { 
      "type" : "string" 
     } 
    } 
} 
+0

Thnaksを!問題は、この「マッピング」がオンザフライで作成されていることです。したがって、私はドキュメントをシリアライズしており、ESはマッピングを作成しています。私はそれが最良の選択肢かどうかわからない。各 "metainfo"はユニークで、単一の値しか持たない。 – Jordi

+0

このプロパティのマッピングを明示的に作成する必要があります。 https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.htmlを参照してください。データを挿入する前にこれを行う必要があります。 – mbudnik

関連する問題