私は次のアノテーションベースの弾性検索設定を持って、私はこれらのフィールドはトークン化されないようにするために分析されていないインデックスを設定しました:弾性検索大文字小文字を区別しない
@Document(indexName = "abc", type = "efg")
public class ResourceElasticSearch {
@Id
private String id;
@Field(type = FieldType.String, index = FieldIndex.not_analyzed)
private String name;
@Field(type = FieldType.String, store = true)
private List<String> tags = new ArrayList<>();
@Field(type = FieldType.String)
private String clientId;
@Field(type = FieldType.String, index = FieldIndex.not_analyzed)
private String virtualPath;
@Field(type = FieldType.Date)
private Date lastModifiedTime;
@Field(type = FieldType.Date)
private Date lastQueryTime;
@Field(type = FieldType.String)
private String modificationId;
@Field(type = FieldType.String)
private String realPath;
@Field(type = FieldType.String)
private String extension;
@Field(type = FieldType.String)
private ResourceType type;
をすることによって、それが可能です注釈を使用して名前、仮想パス、およびタグの検索を大文字小文字を区別しないようにしますか?
@Bean
public Client client() throws IOException {
TransportClient client = new TransportClient();
TransportAddress address = new InetSocketTransportAddress(env.getProperty("elasticsearch.host"), Integer.parseInt(env.getProperty("elasticsearch.port")));
client.addTransportAddress(address);
XContentBuilder settingsBuilder = XContentFactory.jsonBuilder()
.startObject()
.startObject("analysis")
.startObject("analyzer")
.startObject("keyword")
.field("tokenizer", "keyword")
.array("filter", "lowercase")
.endObject()
.endObject()
.endObject()
.endObject();
if (!client.admin().indices().prepareExists("abc").execute().actionGet().isExists()) {
client.admin().indices().prepareCreate("abc").setSettings(settingsBuilder).get();
}
return client;
}
実際はありません。春データの設定ではなく、Elasticsearch自体についてです。あなたはnot_analyzedとしてデータを索引付けし、それはそのままになります。また、大文字と小文字を区別しないデータが必要な場合は、 'keyword'アナライザと' lowercase 'トークンフィルタを組み合わせてインデックスを作成するのはなぜですか? –
返事をありがとう、私はそれがまさに私が必要と思う。 – Andrei
Andreiさんは、私がそれを受け入れることができるようにあなたの返信を回答として投稿できますか? – Andrei