2016-06-29 8 views
0

첨부 파일 필드를 인덱싱하려고합니다. 의미있는 POST 쿼리는 예상 결과 집합을 반환합니다. 내 검색어는nest C# elasticsearch 쿼리에서 결과가 반환되지 않습니다.

POST /mydocs/_search 
{ 
    "query" : { 
    "bool" : { 
     "must" : [ 
      { "match" : { "file.content":"abc"} }, 
      { "match":{"otherDetails":"asd"}}, 
      { "match" : { "filePermissionInfo.accountValue" : "xyz"} } 
     ] 
    } 
    } 
} 

로 바꿔주세요. C# 네스트 코드로 변환해야합니다. 나는 그것을 변환하려고 시도했지만 결과가 반환되지 않는다. 심지어 데이터를 포함하고있다. 나는 아래 experssion에서

m.Match(mt1 => mt1.Field(f1 => f1.File.Coontent).Query(queryTerm)) 

를 제거하면, 결과 집합을 반환합니다. 첨부 파일 필드에 문제가 있습니까?

client.Search<IndexDocument>(s => s 
          .Index("mydocs") 
          .Query(q => q 
          .Bool(b => b 
          .Must(m => 
          m.Match(mt1 => mt1.Field(f1 => f1.File.Coontent).Query(queryTerm)) && 
          m.Match(mt2 => mt2.Field(f2 => f2.FilePermissionInfo.First().SecurityIdValue).Query(accountName)) && 
           m.Match(mt3 => mt3.Field(f3 => f3.OtherDetails).Query(other)) 
          ))) 
          );  

내 매핑은 쿼리가 제대로 NEST로 번역되지 않은 것 같습니다

{ 
"mydocs": { 
    "mappings": { 
    "indexdocument": { 
     "properties": { 
      "docLocation": { 
       "type": "string", 
       "index": "not_analyzed", 
       "store": true 
      }, 
      "documentType": { 
       "type": "string", 
       "store": true 
      }, 
      "file": { 
       "type": "attachment", 
       "fields": { 
       "content": { 
        "type": "string", 
        "term_vector": "with_positions_offsets", 
        "analyzer": "full" 
       }, 
       "author": { 
        "type": "string" 
       }, 
       "title": { 
        "type": "string", 
        "term_vector": "with_positions_offsets", 
        "analyzer": "full" 
       }, 
       "name": { 
        "type": "string" 
       }, 
       "date": { 
        "type": "date", 
        "format": "strict_date_optional_time||epoch_millis" 
       }, 
       "keywords": { 
        "type": "string" 
       }, 
       "content_type": { 
        "type": "string" 
       }, 
       "content_length": { 
        "type": "integer" 
       }, 
       "language": { 
        "type": "string" 
       } 
       } 
      }, 
      "filePermissionInfo": { 
       "properties": { 
       "fileSystemRights": { 
        "type": "string", 
        "store": true 
       }, 
       "securityIdValue": { 
        "type": "string", 
        "store": true 
       } 
       } 
      }, 
      "id": { 
       "type": "double", 
       "store": true 
      }, 
      "lastModifiedDate": { 
       "type": "date", 
       "store": true, 
       "format": "strict_date_optional_time||epoch_millis" 
      }, 
      "otherDetails": { 
       "type": "string" 
      }, 
      "title": { 
       "type": "string", 
       "store": true, 
       "term_vector": "with_positions_offsets" 
      } 
     } 
    } 
    } 
    } 
} 

답변

0

입니다. 쿼리에서는

"filePermissionInfo.accountValue" 

을 가지고 있지만 둥지 쿼리 만 만 filePermissionInfo 초래

f2 => f2.FilePermissionInfo 

있습니다. 이 값을

으로 변경해야합니다.
f2 => f2.FilePermissionInfo.AccountValue 
+0

쿼리를 업데이트했지만 결과가 반환되지 않았습니다. 쿼리를 Nest로 올바르게 전송할 수있게 도와주세요. –

+0

@AjA -하지만 데이터가 무엇인지, 무엇을하려고하는지 모르겠습니다. 개별 쿼리 구성 요소를 조각으로 분해하여 이해하고 있습니다. 어떻게 각각이 최종 결과에 기여하는지. 특정 검색어와 일치해야한다고 생각되는 특정 문서가있는 경우 '_explain' API를 사용하여 일치하는지 또는 일치하지 않는지 이해할 수 있습니다 (https://www.elastic.co/guide/en/elasticsearch). /reference/current/search-explain.html –

관련 문제