You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by jeebix <jb...@initiatives.fr> on 2018/07/09 07:35:05 UTC

Sum and aggregation on nested documents field

Hello everybody,

I have a question about how to retrieve results from SOLR with some
aggregation (like sum in my case...) on the nested documents.

First, the data SOLR returned with a standard query : 

{
        "id":"3911.3912.1278",
        "parent_i":3191,
        "asso_i":3112,
        "personne_i":16278,
        "etat_technique_s":"avec_documents",
        "etat_marketing_s":"actif",
        "type_parent_s":"Ecole élémentaire publique",
        "type_asso_s":"APE (association de parents d'élèves)",
        "groupe_type_parent_s":"ENSEIGNEMENT_PRIMAIRE",
        "groupe_type_asso_s":"ASSOCIATION_DE_PARENTS",
        "nombre_commandes_brut_i":8,
        "nombre_commandes_i":3,
        "nombre_kits_saveur_i":4,
        "ca_periode_i":2977,
        "ca_periode_fleur_i":0,
        "ca_periode_saveur_i":2977,
        "zone_scolaire_s":"C",
        "territoire_s":"France Métropolitaine",
        "region_s":"LANGUEDOC-ROUSSILLON MIDI-PYRENEES",
        "departement_s":"30 GARD",
        "postal_country_s":"FR",
        "asso_country_s":"FRANCE",
        "object_type_s":"contact",
        "kits_sans_suite_ss":["Initiatives Saveurs"],
        "date_derni_re_commande_dt":"2017-11-14T00:00:00Z",
        "_version_":1605492468379287553,
        "_childDocuments_":[
        {
          "fixe_facturation":["0465221792"],
          "object_type":["order"],
          "TTC_i":1200,
          "mobile_livraison":["0672655536"],
          "kit_sans_suite":["true"],
          "fixe_livraison":["0466421792"],
          "type_cde_s":"KIT",
          "statut_s":"V",
          "mobile_facturation":["0675255536"],
          "campagne_s":"A",
          "date_dt":"2016-01-24T00:00:00Z",
          "id":"A04520",
          "enseigne_s":"SAV",
          "gamme":["KITS > Kits Saveurs"]},
        {
          "fixe_facturation":["0466521792"],
          "object_type":["order"],
          "TTC_i":15,
          "mobile_livraison":["0672655536"],
          "kit_sans_suite":["false"],
          "fixe_livraison":["0464221792"],
          "type_cde_s":"DOCUMENTATION",
          "statut_s":"V",
          "mobile_facturation":["0672655536"],
          "campagne_s":"B",
          "date_dt":"2016-09-29T00:00:00Z",
          "id":"B15755",
          "enseigne_s":"INI",
          "gamme":["CATALOGUES > Catalogues Brioche",
            "CATALOGUES > Catalogues Fleurs et Nature"]},
        {
          "fixe_facturation":["0465221792"],
          "object_type":["order"],
          "TTC_i":156,
          "mobile_livraison":["0672655536"],
          "kit_sans_suite":["false"],
          "fixe_livraison":["0466221492"],
          "type_cde_s":"KIT",
          "statut_s":"V",
          "mobile_facturation":["0672245536"],
          "campagne_s":"B",
          "date_dt":"2016-09-29T00:00:00Z",
          "id":"B15769",
          "enseigne_s":"SAV",
          "gamme":["KITS > Kits Saveurs"]}

My goal is to get with one SOLR query the sum of TTC_i by parent document...
I tried with facet.pivot, stats, group, with no results...

Thanks for your advices

Best
JB



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html