我有一个存储到嵌入式ES实例的对象:
import csv
import time
import threading
thread_count=2
threads=[]
class Operation():
def data(self):
with open('test.csv','r+') as f:
reader=csv.reader(f)
for row in reader:
print row
def filedata(self):
for i in range(thread_count):
threads.append(threading.Thread(target=self.data,args=()))
start_time=time.time()
for t in threads:
t.start()
t.join()
end_time=time.time()
print end_time-start_time
a=Operation()
a.filedata()
对于按名称搜索,我使用@Document(indexName = "users", type = "user")
public class Uer implements Serializable {
@Id
private String uid;
@Field(type = FieldType.Nested, store = true, includeInParent = true)
private LanguageValue name;
@Data
public static class LanguageValue {
private String eng;
private String deu;
}
}
并传递由通配符包装的值。对于没有变音符号的名字,它工作正常,但任何包含变音符号的名字都没有结果..
错误或配置错误?
答案 0 :(得分:0)
使用 analyzer 参数尝试@Field注释:
@Document(indexName = "lang")
public class Test {
@Id
@Field(type = FieldType.String, index = FieldIndex.no, store = false)
private String id;
@Field(type = FieldType.Nested)
private LanguageValue namecustom;
}
class LanguageValue {
@Field(type = FieldType.String, index = FieldIndex.analyzed, analyzer = "standard", searchAnalyzer = "standard")
private String en;
@Field(type = FieldType.String, index = FieldIndex.analyzed, analyzer = "de_std", searchAnalyzer = "de_std")
private String de;
}
这给出了以下映射:
{
"lang": {
"mappings": {
"test": {
"properties": {
"id": {
"type": "string",
"index": "not_analyzed"
},
"namecustom": {
"type": "nested",
"properties": {
"de": {
"type": "string",
"analyzer": "de_std"
},
"en": {
"type": "string",
"analyzer": "standard"
}
}
}
}
}
}
}
}