last day (14 days later) » 

5:54 PM
hello
 
Hey there
Just to begin with
Could you by any chance share any document that you'd like to query
 
yeah let me try to get one
 
I know raw API quite well, but this shouldn't be too difficult to translate to NEST. I've worked with it a little too.
 
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
createdBy: "QA OneDrive"
createdOn: "2015-03-23T18:33:34Z"
entityId: "bf1ee11f-ebe9-480f-955a-91223eb20111"
entityName: "2ndimpactfileshare.docx"
entityType: 2
extension: "docx"
friendlyUrl: "QA OneDrive/Documents"
keywords: null
lastModified: "2015-03-23T18:33:58Z"
lastModifiedBy: "QA OneDrive"
sentBy: null
serviceId: "d4c381d2-e73e-4dc5-a691-cc11fb48f24e"
storeName: "https://SkyKickUnitTest-my.sharepoint.com/personal/QAOneDriveUser_SkyKickUnitTest_onmicrosoft_com/"
so I want to do a multi value filter on "extension"
 
Second
Let me replicate it
 
5:57 PM
and I see the .Terms func on the Nest client, but am curious if I can do a negation of that easily as well
 
Aha
So what you would pass? A list of terms that you want to filter out
For instance, you'd pass "pdf", "docx", "doc"
You'd like to keep them or to filter them out?
 
the more elegant solution would be to provider the extensions I want filtered OUT
I think I got it
ff.Not(fff => fff.Terms("extensions", extensionsToLeaveOut));
that look ok?
 
aha
that makes sense
So you need bool query
and MUST_NOT
 
using the .Not() would negate my original query I believe
 
Let me do a quick example
just a question
you want these to impact score?
 
5:59 PM
no it doesn't need to
 
So I have to use filter then
 
oh ok
 
It's not going to look very elegant, unfortunately. Due to json querying
I've created a test document on my machine using this:

PUT test/test/1
{
"contentType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"createdBy": "QA OneDrive",
"createdOn": "2015-03-23T18:33:34Z",
"entityId": "bf1ee11f-ebe9-480f-955a-91223eb20111",
"entityName": "2ndimpactfileshare.docx",
"entityType": 2,
"extension": "docx",
"friendlyUrl": "QA OneDrive/Documents",
"keywords": "null",
"lastModified": "2015-03-23T18:33:58Z",
"lastModifiedBy": "QA OneDrive",
"sentBy": "null",
and ran a query that looks like that
POST test/test/_search
{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"bool": {
"must_not": [
{
"terms": {
"extension": [
"docx",
"doc"
]
}
}
]
}
}
}
}
}
So now how it would translate to what you currently have.

You got:

.Filter(ff =>
	ff.Term("serviceId", serviceId) &&
	ff.Term("subscriptionId", subscriptionId) &&
	ff.Term("subscriptionType", subscriptionType) &&
	ff.Term("entityType", entityType)
)
Oh god, I don't have visual studio installed :)

Anyway, you need to wrap these buddies in a bool and a must clause
 
haha oh no
ok though
that looks like it will work
thanks, I will comment on the original post if I have any problems :)
 
Let me try to do a quick query in JSON for you
POST test/test/_search
{
  "query": {
    "filtered": {
      "query": {
        "match_all": {}
      },
      "filter": {
        "bool": {
          "must": [
            {
              "term": {
                "serviceId": "VALUE"
              }
            },
            {
              "term": {
                "subscriptionId": "VALUE"
              }
            },
            {
              "term": {
                "subscriptionType": "VALUE"
              }
            },
            {
 
6:06 PM
Ok thanks I will test that out
 
This should translate from NEST quite simple. I just don't have Visual studio installed at the moment.
 
yeah no problem, I should be able to reverse engineer the JSON into a NEST query
 
NEST documentation is quite poor. It's better to look at official one and try to translate it by yourself. Usually intellisense does it quite well
You'd like me to stay here for a while?
 
yeah I know it is very very poor ha
no I should be able to figure it out
thanks a lot!
 
You don'nt mind if i post raw json query as an example?
Anyway, perhaps NEST call should look like that:

.Filter(ff =>
.query(fq =>
.bool(bq =>
.must(mq =>
mq.Term("serviceId", serviceId) &&
mq.Term("subscriptionId", subscriptionId) &&
mq.Term("subscriptionType", subscriptionType) &&
mq.Term("entityType", entityType)
.must_not( mnq =>
mnq.Terms("extension", listOfExtensions))
)))
)
 

last day (14 days later) »