Currently I am creating Elasticsearch Repository with Class ProductSearch, by adding @document annotation with only indexName, the type should be empty as i didn't manage to add any type to the indexname. But when i call productSearchRepository.findByName(query), it searches inside the indexName with type = "productsearch", here is a snippet of the code.
@Document(indexName = "product")
public class ProductSearch extends Product {
}
here is the productSearch repository
@Repository
public interface ProductSearchRepository extends ElasticsearchRepository<ProductSearch, Long> {
@Query("{\"match\": {\"name.en\" : \"?0\"}}")
List<ProductSearch> findByName(String name);
}
and here is the logs from elasticsearch which shows that it adds a type = "productsearch"
[2016-10-04 14:03:53,634][WARN ][index.search.slowlog.query] [Apache Kid] [product][1] took[112.3micros], took_millis[0], types[productsearch], stats[], search_type[DFS_QUERY_THEN_FETCH], total_shards[5], source[{"from":0,"size":10,"query_binary":"eyJtYXRjaCI6IHsibmFtZS5lbiIgOiAiYWJjIn19"}], extra_source[],
[2016-10-04 14:03:53,634][WARN ][index.search.slowlog.query] [Apache Kid] [product][2] took[243.9micros], took_millis[0], types[productsearch], stats[], search_type[DFS_QUERY_THEN_FETCH], total_shards[5], source[{"from":0,"size":10,"query_binary":"eyJtYXRjaCI6IHsibmFtZS5lbiIgOiAiYWJjIn19"}], extra_source[],
[2016-10-04 14:03:53,634][WARN ][index.search.slowlog.query] [Apache Kid] [product][3] took[154.2micros], took_millis[0], types[productsearch], stats[], search_type[DFS_QUERY_THEN_FETCH], total_shards[5], source[{"from":0,"size":10,"query_binary":"eyJtYXRjaCI6IHsibmFtZS5lbiIgOiAiYWJjIn19"}], extra_source[],
[2016-10-04 14:03:53,634][WARN ][index.search.slowlog.query] [Apache Kid] [product][4] took[161.5micros], took_millis[0], types[productsearch], stats[], search_type[DFS_QUERY_THEN_FETCH], total_shards[5], source[{"from":0,"size":10,"query_binary":"eyJtYXRjaCI6IHsibmFtZS5lbiIgOiAiYWJjIn19"}], extra_source[],
What i need is not to create type for my document.
Any help would be appreciated. thanks in advance.
{"match": {"name.en" : "abc"}}(decoded fromquery_binary) and that it is slow (i.e.index.search.slowlog.query)./product/_searchnot/product/productsearch/_search, please explain further what do you mean by the logs being slow ?