Help traduce a query into map-reduce

Hi
i have a problem with my query because is very slow ,is possible translate it into a map-reduce?
I use this query with java-sdk and is

SELECT SUM (operation), user
BucketTime FROM USE INDEX (indexTest USING GSI)
WHERE environment = “/ root”
AND startTime> 1356998400000
AND endTime <1483228799999
GROUP BY user
ORDER BY DESC INDEX

Environment, startTime and endTime are a variable.

can someone help me ?
Thanks when I do not find solutions

Hi @Alessandro.79

What indexes have you created? Can you run EXPLAIN on that query and post the result? It’s probably an indexing issue.

I would suggest you post your question to the N1QL forum: https://forums.couchbase.com/c/n1ql - @geraldss and others are typically fast and helpful :slight_smile: