의 내가 간단한 ElasticSearch 지수하게 가정 해 봅시다 :ElasticSearch - 동일한 필드 이름을 가진 다른 doc_types하지만 서로 다른 분석기를 검색
curl -XPUT 'http://localhost:9200/test/' -d '{
"settings": {
"analysis": {
"char_filter": {
"de_acronym": {
"type": "mapping",
"mappings": [".=>"]
}
},
"analyzer": {
"analyzer1": {
"type": "custom",
"tokenizer": "keyword",
"char_filter": ["de_acronym"]
}
}
}
}
}'
을 내가 동일한 속성 name
이 두 doc_types을하지만 다르게 약간 분석 서로 :
curl -XPUT 'http://localhost:9200/test/_mapping/docA' -d '{
"docA": {
"properties": {
"name": {
"type": "string",
"analyzer": "simple"
}
}
}
}'
curl -XPUT 'http://localhost:9200/test/_mapping/docB' -d '{
"docB": {
"properties": {
"name": {
"type": "string",
"analyzer": "analyzer1"
}
}
}
}'
:
curl -XPUT 'http://localhost:9200/test/docA/1' -d '{ "name" : "U.S. Army" }'
curl -XPUT 'http://localhost:9200/test/docB/1' -d '{ "name" : "U.S. Army" }'
'미국'을 검색해 봅시다. !
curl -XGET 'http://localhost:9200/test/_search?pretty' -d '{
"query": {
"match_phrase": {
"name": {
"query": "U.S. Army"
}
}
}
}'
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.5,
"hits" : [ {
"_index" : "test",
"_type" : "docA",
"_id" : "1",
"_score" : 1.5,
"_source":{ "name" : "U.S. Army" }
} ]
}
}
내가 하나 개의 결과를 얻을 수
은 내가 docB의 분석기 지정 다른 결과를 얻을 : 동시에 두 문서 유형의 육군 "
curl -XGET 'http://localhost:9200/test/_search?pretty' -d '
{
"query": {
"match_phrase": {
"name": {
"query": "U.S. Army",
"analyzer": "analyzer1"
}
}
}
}'
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "docB",
"_id" : "1",
"_score" : 1.0,
"_source":{ "name" : "U.S. Army" }
} ]
}
}
내가 인상했다가 그 ES는 것 적절한 분석기로 각 DOC_TYPE를 검색 할 수있는 방법이 있나요
ElasticSearch 워드 프로세서
이 precedence for search analyzer가가는 말 :.?1) 분석기 이 경우
2) 다른 필드 매핑에 정의 된 분석기 ...
다른 쿼리 자체에 정의 된, ElasticSearch 임의로 사용할 필드 매핑 선택인가?