At first impression, everything seems ok. Anyway, is the startTimeISO single-value or multivalued field? In case it is single-value the clause startTimeISO:["2015-01-19T00: 00:00.000Z" TO "2015-01-20T00:00:00.000Z"]" is sufficient to exclude other period of time. I also guess that the startTimeISO fieldtype is date.
Other option for rewriting your query (just for testing as I can't find any problem in the query you presented) q=*:* fq=startTimeISO:[NOW/DAY-1DAYS TO NOW] raw parameters: facet.pivot=userName,startTimeISO It will be also helpful to know the raw response, just to discard that the name bla doesnt appear in different documents. For example usin: query: userName:bla fq=startTimeISO:[NOW/DAY-1DAYS TO NOW] fl= id,userName, startTimeISO Hope it helps. On Tue, Jan 20, 2015 at 5:09 AM, harish singh <harish.sing...@gmail.com> wrote: > Hi, > > I have asked a question on Stackoverflow: > http://stackoverflow.com/questions/28036051/solr-newly-observed-facets > > I searched the mailing list and found that not many reply there. So asking > the same question here: > > have two fields in my solr index data: "userName" and "startTimeISO" along > with many other fields. Now I want to query for all the "userNames" that > were seen TODAY but not seen in the last 30 days. Basically, I am trying to > find out Newly Observed UserNames for today. > > Now the Solr Facet query I am running is: > > facet.pivot: "userName,startTimeISO", > fq: " NOT startTimeISO:["2014-12-20T00:00:00.000Z" TO > "2015-01-18T00:00:00.000Z"] AND > startTimeISO:["2015-01-19T00:00:00.000Z" TO > "2015-01-20T00:00:00.000Z"]" > > But I am for some reason getting incorrect results. For example, I see > userName: "bla" the above query. If I run the same query for tomorrow, I am > again see "bla" in my Facet Results. > > I am some how not able to get the correct logic. Perhaps I am not using all > the tools provided by solr, which I am unaware of? > > Can someone help me here? I dont mind testing all of your suggestions and > coming back and forth with different suggestions. > > > Thanks, > > Harish >