2014-05-23 3 views
2

다음과 같이 색인 된 데이터가 구성되었습니다. ES 1.1.1과 Nest 1.0.0-beta1을 사용합니다.ElasticProperty - Nest에서 인덱싱이 작동하지 않음 - ElasticSearch

Analyzer 

{ 
"index": { 
    "analysis": { 
    "analyzer": { 
    "allwords": { 
     "type": "custom", 
     "tokenizer": "allwords_tokenizer", 
     "filter": [ 
     "asciifolding", 
     "lowercase", 
     "my_stop", 
     "standard" 
     ] 
    } 
    }, 
    "tokenizer": { 
    "allwords_tokenizer": { 
     "type": "keyword", 
     "max_token_length": 255 
    } 
    }, 
    "filter": { 
    "my_stop": { 
     "type": "stop", 
     "stopwords": "_none_" 
    } 
    } 
} 
} 
} 

그리고

Mapping 

{ 
"properties": { 
"name": { 
    "type": "string", 
    "fields": { 
    "raw": { 
     "type": "string", 
     "analyzer": "allwords" 
    } 
    } 
    } 
    } 
} 

내 ES 개체는

[ElasticType(Name = "profile",IdProperty = "Id")] 
public class ES_Profile 
{ 
    public string Id { get; set; } 

    [ElasticProperty(Name = "name.raw", Type = FieldType.string_type, SearchAnalyzer = "allwords", Store = false)] 
    public string name_raw { get; set; } 

    public string name { get; set; } 
} 

문제는 색인입니다.

[ElasticProperty(Name = "name.raw", Type = FieldType.string_type, SearchAnalyzer = "allwords", Store = false)] 
    public string name_raw { get; set; } 

없이 완벽하게 인덱스 데이터를 작동하지만 나는 그것을 사용하는 경우 "name_raw"포함, 실패합니다.

아래 응답이 있는데 문제를 이해하지 못했습니다. 나는 인덱스에 대한 설정을 얻을 때

{ 
    StatusCode: 200, 
    Method: POST, 
    Url: http://127.0.0.1:9200/hzmt_x/profile/1115A2F8-07AE-4E9D-A6CF-7DFF3BD8789D, 
    Request: {"id": "1115A2F8-07AE-4E9D-A6CF-7DFF3BD8789D", "name": "My Name" 
}, 
Response: {"_index":"hzmt_x","_type":"profile","_id":"1115A2F8-07AE-4E9D-A6CF-7DFF3BD8789D","_version":8,"created":false}} 

, 나는 내가

 { 
    hzmt_x: { 
    mappings: { 
     profile: { 
     properties: { 
      id: { 
      type: string 
      } 
      name: { 
      type: string 
      fields: { 
       raw: { 
       type: string 
       analyzer: allwords 
       } 
      } 
      } 
     } 
     } 
    } 
    } 
    } 

있어, 맵핑의

{ 
hzmt_x: { 
settings: { 
    index: { 
    uuid: ahOhgj17QOyCVFcO2aRf1A 
    analysis: { 
     filter: { 
     my_stop: { 
      type: stop 
      stopwords: _none_ 
     } 
    } 
    analyzer: { 
     allwords: { 
     type: custom 
     filter: [ 
     asciifolding 
     lowercase 
     my_stop 
     standard 
     ] 
     tokenizer: allwords_tokenizer 
     } 
     allwords_tokenizer: { 
     type: keyword 
     max_token_length: 255 
     } 
    } 
    } 
    } 
} 
} 
} 

얻었다 "name_raw"인덱스 시간 분석 필드 내가 거기있을 생각합니다 그래서입니다 아무런 문제가 없지만 나는 가지고있다.

문제를 해결하려면 어떻게해야합니까? 의견 있으십니까?

감사합니다, 둥지의 버전이 사용중인 오구 즈

답변

0

? 최신 version.Below 코드를 업데이트 나를 위해 작동합니다.

var rep = client.CreateIndex("test", c => c 

        .AddMapping<object>(m => m 
         .Properties(props => props 
          .String(ps => ps.Name(""name_raw").IndexAnalyzer("keyword")) 

          ))); 
관련 문제