Find distinct values, not distinct counts in elasticsearch

前端 未结 4 1082
陌清茗
陌清茗 2020-11-30 06:38

Elasticsearch documentation suggests* that their piece of code

*documentation fixed

GET /cars/transactions/_search?search_type=         


        
4条回答
  •  自闭症患者
    2020-11-30 07:11

    While I appreciate the idea of leveraging Kibana to answer this question, I was unable to accomplish it in exactly the way described by @Phlucious. Here is how I proceeded (Kibana and Elasticsearch 7.8.1):

    1. Open Kibana's main Discover tool: and click its Add filter link to narrow your search as much as possible;

    2. In Kibana's Available fields side-menu, left-click on the field you wish to extract distinct values of (in my case, data.vulnerability.package.condition):

    3. This will open a menu containing the top 5 values of this field, followed by a button labelled Visualize. Click on Visualize to open a visualization of the top values of your field:

    4. Left-click the Inspect link above this chart. A sub-screen opens in which you may view the top values for your selected field:

    5. In the upper right-hand corner of this sub-screen find a link labelled View: Data. Left-click it to choose Requests instead. In the header of the new sub-screen which appears you may click Request to access the Elasticsearch query Kibana used to generate your graph and chart:

    Note that the value for size in my Request as shown in the image above is 100; initially it was 20, which is Kibana's default setting for Number of terms. I changed it to 100 in Kibana's Advanced Settings screen:

提交回复
热议问题