【发布时间】:2014-05-23 13:58:09
【问题描述】:
我有一个如下配置的索引数据。我使用 ES 1.1.1 和 Nest 1.0.0-beta1。
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: {
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
}
}
}
}
}
}
}
对于映射,我得到了
{
hzmt_x: {
mappings: {
profile: {
properties: {
id: {
type: string
}
name: {
type: string
fields: {
raw: {
type: string
analyzer: allwords
}
}
}
}
}
}
}
}
“name_raw”是索引时间分析的字段,所以我认为应该没有问题,但我有一个。
我可以为这个问题做些什么?你有什么建议吗?
谢谢, 奥古兹
【问题讨论】:
标签: c# elasticsearch nest