제가 사용한 탄성 검색 버전은 es2.2입니다. 전체 텍스트 검색에 대한 공식 자습서와 동일한 코드를 입력합니다. (https://www.elastic.co/guide/en/elasticsearch/guide/current/match-query.html)탄성 검색 : 전체 텍스트 검색이 작동하지 않습니다.
나를 위해 전체 텍스트가 작동하지 않는 것 같습니다. 제 설정에 뭐가 잘못 됐나요? 감사!
코드 I 유형은 다음과 같습니다 :
curl -XDELETE 'localhost:9200/my_index '
curl -XPUT 'localhost:9200/my_index ' -d '
{
"settings": { "number_of_shards": 1 }
}'
curl -XPOST 'localhost:9200/my_index/my_type/_bulk' -d'
{ "index": { "_id": 1 }}
{ "title": "The quick brown fox" }
{ "index": { "_id": 2 }}
{ "title": "The quick brown fox jumps over the lazy dog" }
{ "index": { "_id": 3 }}
{ "title": "The quick brown fox jumps over the quick dog" }
{ "index": { "_id": 4 }}
{ "title": "Brown fox brown dog" }'
curl -XGET 'localhost:9200/my_index/my_type/_search' -d'
{
"query": {
"match": {
"title": "QUICK!"
}
}
}'
반환 된 결과입니다 : { "했다": 1, "TIMED_OUT"거짓 "_ 파편": { "총": 1, "성공": 1
정확한 쿼리를 입력 할 때 단 하나의 히트 만 얻을 수 있습니다. 예를 들어, "실패": 0, "히트": { "총": 0, "max_score" 인덱스에 저장됩니다.
curl -XGET 'localhost:9200/my_index/my_type/_search' -d'
{
"query": {
"match": {
"title": "The quick brown fox"
}
}
}'
출력은 다음과 같습니다 은 { "했다": 1, "TIMED_OUT"거짓 "_ 파편": { "총": 1, "성공": 1, "실패": 0} " 조회 : ","_ 유형 ":"_ 유형 ","_ ID ":"1 ","_ 점수 ":"{총 ": 1,"최대 점수 ": 1.4054651,"조회수 " 1.4054651, "_ 소스": { "제목": "빠른 갈색 여우"} :
curl -XGET 'localhost:9200/_analyze' -d'
{
"analyzer": "standard",
"text": "Text to analyze"
}'
은 컬 (6) 호스트를 확인할 수 없습니다}]}} 나는 또한 분석기를 테스트
'가져 오기' { "t 0 ","end_offset ": 4,"type ":" ","position ": 0}, {"token ":"to ","start_offset " ": 5,"end_offset ": 7,"type ":" ","position ": 1}, {"토큰 ":"분석 ","시작 오프셋 ": 8,"end_offset ": 15,"type " ","position ": 2}]}
이 오류가 결과에 영향을 줍니까?
그래서 어떤 쿼리를 실행하면 "잘못된"결과가 발생합니까? – rednaw
쿼리가 코드에 표시됩니다. 그것은 : curl -XGET 'localhost : 9200/my_index/my_type/_search'-d ' { "query": { "일치": { "제목": "QUICK!" } } } ' – chocolate9624
'QUICK! '대신'quick' 만 검색하려고 했습니까? 또한 마지막 검색은'curl' 명령으로'GET'을 두 번합니다. – rednaw