Pipeline Aggregation output not as expectedElastic Search Aggregation with scripting giving exceptionElasticsearch aggregation. Order by nested bucket doc_countScope 0 count terms in aggregation in ElasticSearchElastic Search Date Histogram is not working for 24 hour FormatAggregate results of top_hits with date_histogram or similar?Elasticsearch applying filters to aggregationCan i use _source field inside aggregations?Keep the documents with a missing field in the filter query resultsElasticSearch Cardinality issueSimple (non-nested) Multi-field terms aggregation on nested field using script

Can two figures have the same area, perimeter, and same number of segments have different shape?

How could a thief buying plane tickets with stolen credit card details benefit personally?

Why are all my history books dividing Chinese history after the Han dynasty?

401(k) investment after being fired. Do I own it?

Why are so many countries still in the Commonwealth?

Unethical behavior : should I report it?

Assuring luggage isn't lost with short layover

Iterate over non-const variables in C++

What do I do when a student working in my lab "ghosts" me?

What's the difference between 2a and 10a charging options?

Is my employer paying me fairly? Going from 1099 to W2

What to do when you reach a conclusion and find out later on that someone else already did?

How to change the font style (not the size but the style) of algorithimc package

kids pooling money for Lego League and taxes

Where to place an artificial gland in the human body?

Would this neural network have short term memory?

3D Statue Park: U shapes

Is a fighting a fallen friend with the help of a redeemed villain story too much for one book

Does academia have a lazy work culture?

How do I stop my characters falling in love?

Marrying a second woman behind your wife's back: is it wrong and can Quran/Hadith prove this?

This message is flooding my syslog, how to find where it comes from?

Are there any examples of technologies have been lost over time?

How can I stop myself from micromanaging other PCs' actions?



Pipeline Aggregation output not as expected


Elastic Search Aggregation with scripting giving exceptionElasticsearch aggregation. Order by nested bucket doc_countScope 0 count terms in aggregation in ElasticSearchElastic Search Date Histogram is not working for 24 hour FormatAggregate results of top_hits with date_histogram or similar?Elasticsearch applying filters to aggregationCan i use _source field inside aggregations?Keep the documents with a missing field in the filter query resultsElasticSearch Cardinality issueSimple (non-nested) Multi-field terms aggregation on nested field using script






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















This is what i want to achieve. I want to get the number of times employees have visited given state/country.
Following is the data present as formate EmployeeId, state/country



E1, France

E2, France

E2, France

E3, France

E3, France

E4, France



Desired output:

2 employee 2 times

2 employee 1 times



Following is my query:



POST _search

"query":
"bool":
"must":

"match":
"country": "France"



,
"aggs":
"employees":
"terms":
"field": "employeeId",
"size": "10"
,
"aggs":
"countVisited":
"value_count":
"field": "employeeId"



,
"types_count":
"cardinality":
"field": "countVisited"






But this is just returning per employee count i.e

E1, 1

E2, 2

E3, 2

E4, 1



Any suggestions how can i achieve the needed output ?










share|improve this question




























    0















    This is what i want to achieve. I want to get the number of times employees have visited given state/country.
    Following is the data present as formate EmployeeId, state/country



    E1, France

    E2, France

    E2, France

    E3, France

    E3, France

    E4, France



    Desired output:

    2 employee 2 times

    2 employee 1 times



    Following is my query:



    POST _search

    "query":
    "bool":
    "must":

    "match":
    "country": "France"



    ,
    "aggs":
    "employees":
    "terms":
    "field": "employeeId",
    "size": "10"
    ,
    "aggs":
    "countVisited":
    "value_count":
    "field": "employeeId"



    ,
    "types_count":
    "cardinality":
    "field": "countVisited"






    But this is just returning per employee count i.e

    E1, 1

    E2, 2

    E3, 2

    E4, 1



    Any suggestions how can i achieve the needed output ?










    share|improve this question
























      0












      0








      0








      This is what i want to achieve. I want to get the number of times employees have visited given state/country.
      Following is the data present as formate EmployeeId, state/country



      E1, France

      E2, France

      E2, France

      E3, France

      E3, France

      E4, France



      Desired output:

      2 employee 2 times

      2 employee 1 times



      Following is my query:



      POST _search

      "query":
      "bool":
      "must":

      "match":
      "country": "France"



      ,
      "aggs":
      "employees":
      "terms":
      "field": "employeeId",
      "size": "10"
      ,
      "aggs":
      "countVisited":
      "value_count":
      "field": "employeeId"



      ,
      "types_count":
      "cardinality":
      "field": "countVisited"






      But this is just returning per employee count i.e

      E1, 1

      E2, 2

      E3, 2

      E4, 1



      Any suggestions how can i achieve the needed output ?










      share|improve this question














      This is what i want to achieve. I want to get the number of times employees have visited given state/country.
      Following is the data present as formate EmployeeId, state/country



      E1, France

      E2, France

      E2, France

      E3, France

      E3, France

      E4, France



      Desired output:

      2 employee 2 times

      2 employee 1 times



      Following is my query:



      POST _search

      "query":
      "bool":
      "must":

      "match":
      "country": "France"



      ,
      "aggs":
      "employees":
      "terms":
      "field": "employeeId",
      "size": "10"
      ,
      "aggs":
      "countVisited":
      "value_count":
      "field": "employeeId"



      ,
      "types_count":
      "cardinality":
      "field": "countVisited"






      But this is just returning per employee count i.e

      E1, 1

      E2, 2

      E3, 2

      E4, 1



      Any suggestions how can i achieve the needed output ?







      elasticsearch






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 26 at 17:21









      XephoniaXephonia

      738 bronze badges




      738 bronze badges






















          0






          active

          oldest

          votes










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55362903%2fpipeline-aggregation-output-not-as-expected%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes




          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55362903%2fpipeline-aggregation-output-not-as-expected%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript