N1QL Index issue on sort

#1

I have the below N1QL Query witch i use in a grid to show user Data

SELECT
meta(f).id as DocId,
f.tract,
f.PropertyAddress.houseNumber,
f.PropertyAddress.streetName,
t.name AS tract_name
FROM Contacts AS f
LEFT JOIN Contacts AS t
ON t._type ="tract_info" AND ANY b IN t.tract_id SATISFIES b = f.tract END
WHERE f._type="farm"
order by f.PropertyAddress.streetName , TONUMBER(f.PropertyAddress.houseNumber)
Limit 100 Offset 0

when i use this query with the order clause it take 3.5 sec to return Data against a 3K document set.
If i go and remove the order by clause it takes 250ms.

I created 2 indexes which i hoped would help

CREATE INDEX ix3 ON Contacts(PropertyAddress.streetName , PropertyAddress.houseNumber) WHERE (_type = “farm”)
CREATE INDEXix4ONContacts(PropertyAddress) WHERE (_type= "farm")

But it looks like it never uses any of these indexes

#2

Predicate must have leading index key to choose index.

  SELECT
          META(f).id AS DocId, f.tract,
          TONUMBER(f.PropertyAddress.houseNumber),
          f.PropertyAddress.streetName,
          t.name AS tract_name
    FROM Contacts AS f
    LEFT JOIN Contacts AS t
    ON t._type ="tract_info" AND ANY b IN t.tract_id SATISFIES b = f.tract END
    WHERE f._type="farm" AND f.PropertyAddress.streetName IS NOT NULL
    ORDER BY f.PropertyAddress.streetName , TONUMBER(f.PropertyAddress.houseNumber)
    OFFSET 0
    LIMIT 100 ;

    CREATE INDEX ix3 ON Contacts( PropertyAddress.streetName, TONUMBER(PropertyAddress.houseNumber, tract) WHERE ( _type  = "farm");

    CREATE INDEX ix4 ON Contacts ( DISTINCT tract_id, name) WHERE (_type = "tract_info");

https://blog.couchbase.com/create-right-index-get-right-performance/

https://blog.couchbase.com/offset-keyset-pagination-n1ql-query-couchbase/