Question on how to get sorting working in Elasticsearch index, so fields in Kibana->Discover can be sortable

I am running Elasticsearch 6.5.3 and using logstash/beats to read a query from mysql database, and add to an Elasticsearch index.

The mysql fields are a mix of strings and numbers e.g.

*| Subject ID | Category | Description | Date Added | Owner |*
*| 101 | Computing | An Introduction to Computer Science | 2020-02-01 | Joe Blogs |*

My logstash/beats configuration is as follow :-

    bash> cat /etc/logstash/conf.d/10-jenkins-qa.conf
    input {
        beats {
            port => 5044
        }
      jdbc {
        jdbc_driver_library => "/usr/share/logstash/mysql-connector-java-8.0.17.jar"
        jdbc_driver_class => "com.mysql.jdbc.Driver"
        jdbc_connection_string => "jdbc:mysql://<my-server>/<my-database>"
        jdbc_user => <username>
        jdbc_password => <password>
        statement => "select c.ID, c.name, tp.comment1 as description, tp.date_added, to.owner from ....... etc"
        type => "my_first_index"
        schedule => "* * * * *"
        last_run_metadata_path => "/usr/share/logstash/logstash_last_run_my_first_index"
        tracking_column => "category_id"
        use_column_value => true
      }
    }

    filter {
    }

    output {
        if [type] == "my_first_index"{
            elasticsearch {
                    hosts => ["localhost:9200"]
                    manage_template => false
                    index => "%{type}-%{+YYYY.MM.dd}"
                    document_id => "%{id}"
            }
        }
    }

==============================================================================

As soon as I start Logstash - I see that it is successfully pulling data into Elasticsearch (view /var/log/logstash/logstash-plain.log), and also
see the index created with 'curl -X GET "http://localhost:9200/_cat/indices"'

I am then using Kibana->Discover to view the fields in this index - so when I add selected fields I try and sort on these (e.g. Category, Description, Owner)

but none of these are sortable ....

I disabled the 'Hide Missing Fields' and can see fields such as 'Category.keyword' but these have no values displayed (however they have sort arrows that can be used)

So my question is :-

  • how can I make my main fields sortable ?

Or

  • How can I add content to the 'keyword' fields ?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.