2016-06-17 3 views
0

elasticsearch2.3.3とNest 2.3.2を使用して添付ファイルのインデックスを作成しました。インデックスは以下のとおりです。私はドキュメント内に複数形の単数形の単語を探しています。読み込み中の雪玉茎はこの種の変換を行います。しかし、レコードは検索で返されませんでした。そこに追加のプラグイン/単語コレクションが必要になりました。誰も助けることができます。Snowball stemmerが機能しない

{ 
"mydocs":{ 
    "aliases":{ 

    }, 
    "mappings":{ 
    "indexdocument":{ 
     "properties":{ 
      "docLocation":{ 
       "type":"string", 
       "index":"not_analyzed", 
       "store":true 
      }, 
      "documentType":{ 
       "type":"string", 
       "store":true 
      }, 
      "file":{ 
       "type":"attachment", 
       "fields":{ 
       "content":{ 
        "type":"string" 
       }, 
       "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" 
       } 
       } 
      }, 
      "id":{ 
       "type":"double", 
       "store":true 
      }, 
      "lastModifiedDate":{ 
       "type":"date", 
       "store":true, 
       "format":"strict_date_optional_time||epoch_millis" 
      }, 
      "title":{ 
       "type":"string", 
       "store":true, 
       "term_vector":"with_positions_offsets" 
      } 
     } 
    } 
    }, 
    "settings":{ 
    "index":{ 
     "creation_date":"1466180794989", 
     "analysis":{ 
      "filter":{ 
       "nGram":{ 
       "min_gram":"2", 
       "side":"front", 
       "type":"edge_ngram", 
       "max_gram":"20" 
       } 
      }, 
      "analyzer":{ 
       "partial":{ 
       "filter":[ 
        "standard", 
        "asciifolding", 
        "lowercase", 
        "snowball" 
       ], 
       "type":"custom", 
       "tokenizer":"nGram" 
       }, 
       "full":{ 
       "filter":[ 
        "standard", 
        "asciifolding", 
        "lowercase", 
        "snowball", 
        "nGram" 
       ], 
       "type":"custom", 
       "tokenizer":"standard" 
       } 
      } 
     }, 
     "number_of_shards":"5", 
     "number_of_replicas":"1", 
     "uuid":"tc-yTpbIQGeGDMOOMspf_g", 
     "version":{ 
      "created":"2030399" 
     } 
    } 
    }, 
    "warmers":{ 

    } 
} 
} 

私もstemmer_overrideを試しました。しかし運がない

+0

誰を返します。より明確にする必要がある場合はお知らせください。私はelasticsearchで新しいです –

答えて

0

私は問題を見つけました。アナライザーが添付ファイルフィールドに設定されていません。

var fullNameFilters = new List<string> { "lowercase", "snowball" }; 
     client.CreateIndex("mydocs", c => c 
       .Settings(st => st 
         .Analysis(anl => anl 
         .Analyzers(h => h 
          .Custom("full", ff => ff 
           .Filters(fullNameFilters) 
           .Tokenizer("standard")) 
          ) 
          .TokenFilters(ba => ba 
           .Snowball("snowball", sn => sn 
            .Language(SnowballLanguage.English)))      
          )) 
         .Mappings(mp => mp 
         .Map<IndexDocument>(ms => ms 
         .AutoMap() 
         .Properties(ps => ps 
          .Nested<Attachment>(n => n 
           .Name(sc => sc.File) 
          .AutoMap() 
          )) 
         .Properties(at => at 
         .Attachment(a => a.Name(o => o.File) 
         .FileField(fl=>fl.Analyzer("full")) 
         .TitleField(t => t.Name(x => x.Title) 
         .Analyzer("full") 
         .TermVector(TermVectorOption.WithPositionsOffsets) 
         ))) 

         ))       
         ); 

て、http:localhostを:9200/mydocsと私を助けてください

{ 
"mydocs":{ 
    "aliases":{ 

    }, 
    "mappings":{ 
    "indexdocument":{ 
     "properties":{ 
      "docLocation":{ 
       "type":"string", 
       "index":"not_analyzed", 
       "store":true 
      }, 
      "documentType":{ 
       "type":"string", 
       "store":true 
      }, 
      "file":{ 
       "type":"attachment", 
       "fields":{ 
       "content":{ 
        "type":"string", 
        "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":{ 
       "accessControlType":{ 
        "type":"string", 
        "store":true 
       }, 
       "accountValue":{ 
        "type":"string", 
        "store":true 
       }, 
       "fileSystemRights":{ 
        "type":"string", 
        "store":true 
       }, 
       "isInherited":{ 
        "type":"string", 
        "store":true 
       } 
       } 
      }, 
      "id":{ 
       "type":"double", 
       "store":true 
      }, 
      "lastModifiedDate":{ 
       "type":"date", 
       "store":true, 
       "format":"strict_date_optional_time||epoch_millis" 
      }, 
      "title":{ 
       "type":"string", 
       "store":true, 
       "term_vector":"with_positions_offsets" 
      } 
     } 
    } 
    }, 
    "settings":{ 
    "index":{ 
     "creation_date":"1466482894271", 
     "analysis":{ 
      "filter":{ 
       "snowball":{ 
       "type":"snowball", 
       "language":"English" 
       } 
      }, 
      "analyzer":{ 
       "full":{ 
       "filter":[ 
        "lowercase", 
        "snowball" 
       ], 
       "type":"custom", 
       "tokenizer":"standard" 
       } 
      } 
     }, 
     "number_of_shards":"5", 
     "number_of_replicas":"1", 
     "uuid":"PpxcRl29QTCPtFcsd3PHtw", 
     "version":{ 
      "created":"2030399" 
     } 
    } 
    }, 
    "warmers":{ 

    } 
    } 
}