I was using Sharepoint Rest api and the query looked like the one below

http://sitename/HR/_api/web/lists/GetByTitle('Employee')/Items?$top=4000&$filter=( substringof('100',Title) and substringof('ARISPL',Company) and substringof('HIBIS',House_x0020_Name))

Now I want to migrate to Search Api as querying against Note fields is not possible in Rest API

I was able to get items from the list with below query


but I am not sure how to add filters against fields with Contains and a and condition

I tried the below query but it didnt work


Can someone help?

I want to convert the above rest api query to search api query


3 Answers 3


You should try out the SharePoint 2013 Search Query Tool. It will help you craft your query and show you the results.

You can use the colon as a contains operator :. In KQL AND is the default behavior between terms. I think your query would be something like: querytext='Path:http://sitename/HR/Lists/Employee/* Department:mvrla Title:1000' which should be the same as: querytext='Path:http://sitename/HR/Lists/Employee/* AND Department:mvrla AND Title:1000'

  • 1
    I interpreted 'contains' as a search where : *meth* returns something Mar 25, 2017 at 12:31

There is no contains filter

Search has different syntax

  • 1
    Danny, I think he's asking for contains in REST Search not the REST OData. Mar 25, 2017 at 12:25
  • Yes, link 3 and 4 point to Search Documentation, are they not correct? Mar 25, 2017 at 12:28
  • The links are great. It was your statement that there is "no contains filter". Do you mean in REST? Mar 26, 2017 at 12:12
  • afaik, not in Search either, you can only have one wildcard in a searchstring(?) So you can't search for *msterda* Mar 27, 2017 at 11:59
  • 3
    Nope, = is equals : is contains. itunity.com/article/… Mar 28, 2017 at 11:23

The KQL query to use AND operation is as follows

<<siteurl>>/_api/search/query?querytext='Path:Path:http://sitename/HR/Lists/Employee (Department:mrvla) (Title:1000)'

You should enclose in double quote if you want exact match and space will treat as AND operation.

The above code blocks works as Path starts with given value and Department starts with mrvla and Title starts with 1000. There is no contains operation in a word.

Here is a MSDN article to know the keyword search options.


Thanks, Venkat Konjeti

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.