title: Redis query with Latest date and unique id
body: <p>We are using Redis connection with JedisConnectionFactory and using CrudRepository for querying data</p>
  
  <pre><code>@Component
  @Configuration
  public class RedisConfig {
  
    @Bean
    public RedisTemplate&lt;String, Object&gt; redisTemplate(RedisProperties redisProperties) {
      RedisTemplate&lt;String, Object&gt; template = new RedisTemplate&lt;&gt;();
      template.setConnectionFactory(jedisConnectionFactory(redisProperties));
      return template;
    }
  
    private JedisConnectionFactory jedisConnectionFactory(RedisProperties redisProperties) {
      RedisStandaloneConfiguration redisStandaloneConfiguration =
          new RedisStandaloneConfiguration(redisProperties.getHost(), redisProperties.getPort());
      return new JedisConnectionFactory(redisStandaloneConfiguration);
    }
  }
  </code></pre>
  
  <p>My Redis Object </p>
  
  <pre><code>@RedisHash("Resource")
  public class ResourceDto {
      @Id private String resourceId;
      @Indexed private Date lastUpdatedDate;
      private String resource;
  }
  </code></pre>
  
  <p>I want to fetch all unique ResourceDto by resourceId with Latest lastUpdatedDate. 
  I have tried with few things
  Using findByDistinctResourceId() but it gives error
  Is there any alternative?
  Dont know how to query for this kind of result using RedisTemplate</p>
  
  <pre><code>public static void main(String[] args) {
      ApplicationContext ctx =
          SpringApplication.run(Application.class, args);
  
      RedisTemplate redisTemplate=ctx.getBean(RedisTemplate.class);
      RedisScript redisScript=new RedisScript() {
        @Override
        public String getSha1() {
          return null;
        }
  
        @Override
        public Class getResultType() {
          return ResourceDto.class;
        }
  
        @Override
        public String getScriptAsString() {
          return "SORT Resource BY nosort";
        }
      };
      redisTemplate.execute(redisScript,null,null);
  
    }
  </code></pre>
  
  <p>RedisTemplate is configured properly but dont know how to query for all unique ResourceDto by resourceId with Latest lastUpdatedDate</p>