2016-07-25 2 views
0

전기 탄성 검색이 예외를 org.elasticsearch.index.query.QueryParsingException 예외 : [MyApp를 [매치]탄성 검색어 - 탄성 됨 1.7

http://localhost:9200/ 
     GET myapp/_search/ 
    { 
     "query": { 
     "filtered": { 
      "filter": { 
      "bool": { 
       "must": [ 
       { 
        "match": { 
        "userName": "Micky" 
        } 
       }, 
       { 
        "match": { 
        "Age": 21 
        } 
       } 
       ], 
       "should": [], 
       "must_not": [] 
      } 
      } 
     } 
     }, 
     "from": 0, 
     "size": 20 
    } 

이유 조회를 위해 등록 된 필터 없음 잘못된 것입니까 (기술적 인 세부 사항)?

+0

가능한 복제 [ElasticSearch : \에 등록 된 필터 없음 [일치 \] \]] (http://stackoverflow.com/questions/21116803/elasticsearch-no-filter-registered-for-match) – Mico

답변

0

는 대신

POST myapp/_search/ 
{ 
    "query": { 
    "filtered": { 
     "filter": { 
     "bool": { 
      "must": [ 
      { 
       "term": { 
       "userName": "Micky" 
       } 
      }, 
      { 
       "term": { 
       "Age": 21 
       } 
      } 
      ], 
      "should": [], 
      "must_not": [] 
     } 
     } 
    } 
    }, 
    "from": 0, 
    "size": 20 
} 

term를 사용하거나하는 필터가 없기 때문에 대신 filteredconstant_score 쿼리를 사용할 수 있습니다, match라는 이름의 필터가 없습니다.

POST myapp/_search/ 
{ 
    "query": { 
    "constant_score": { 
     "query": { 
     "bool": { 
      "must": [ 
      { 
       "match": { 
       "userName": "Micky" 
       } 
      }, 
      { 
       "match": { 
       "Age": 21 
       } 
      } 
      ], 
      "should": [], 
      "must_not": [] 
     } 
     } 
    } 
    }, 
    "from": 0, 
    "size": 20 
} 
+0

예외 "오류": "org.elasticsearch.index.query.QueryParsingException : [myapp] 요청은 [보낸 사람]을 지원하지 않습니다." –

+0

잘못된 복사/붙여 넣기? 나를 위해 잘 작동합니다. – Val

+0

나쁜 붙여 넣기 !! , 고마워, 둘째 날 잘 작동, 첫 번째 하나의 데이터를 반환하지 않습니다 –