The rest query is as follows, I want to get most viewed pages. I have used
ViewsLifeTime property. This query returns some pages (unwanted) which their
ViewsLifeTime is null.
https://domain.com/_api/search/query?querytext='ContentTypeId:0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39*'&sortlist='ViewsLifeTime:descending'&filter=ViewsLifeTime gt '0'
I have tested with eq, ne as well.
The ViewsLifeTime of unwanted pages is like:
<d:element m:type="SP.KeyValue"> <d:Key>ViewsLifeTime</d:Key> <d:Value m:null="true"/> <d:ValueType>Null</d:ValueType> </d:element>
But I want to have those pages is viewed (ViewsLifeTime is not null) like:
<d:element m:type="SP.KeyValue"> <d:Key>ViewsLifeTime</d:Key> <d:Value>14</d:Value> <d:ValueType>Edm.Int64</d:ValueType> </d:element>
The other problem with this query is it returns all pages within the farm. I want to get pages only from current Site collection.
How do I filter out those pages that have not been viewed (ViewsLifeTime is null) and restrict the result to current Site Collection?