2017-12-29 9 views
0

스크립트를 사용하여 검색 결과를 제외했지만 예상대로 작동하지 않습니다. 인덱스의 모든 데이터를 확인하면 selluserid 값이 null과 0입니다.탄성 검색 스크립트 쿼리가 작동하지 않습니다.

{ 
    "script": { 
      "script": { 
       "inline": "(doc['isshoper'].value == 0) || params.arrShopUser.get(doc['selluserid'].value.toString())", 
       "params": { 
       "arrShopUser": { 
        "95794": true, 
        "214214": true, 
        "329221": true, 
        "8888": true, 
        "373502": true, 
        "309235": true, 
        "383247": true, 
        "383252": true, 
        "9999": true, 
        "637312": true, 
        "642158": true, 
        "445055": true, 
        "444214": true, 
        "821435": true, 
        "1111": true, 
        "2222": true, 
        "6666": true, 
        "7777": true, 
        "4444": true, 
        "666": true, 
        "777": true, 
        "222": true, 
        "333": true, 
        "555": true, 
        "888": true, 
        "66633": true, 
        "1991944": true, 
        "1991949": true, 
        "1991941": true, 
        "1992000": true, 
        "1992019": true, 
        "1992023": true, 
        "1992046": true, 
        "1992068": true, 
        "1992006": true, 
        "1992055": true 
       } 
       } 
      } 
      } 
     } 

오류 메시지

{ 
    "error": { 
    "root_cause": [ 
     { 
     "type": "script_exception", 
     "reason": "runtime error", 
     "script_stack": [ 
      "(doc['isshoper'].value == 0) || params.arrShopUser.get(doc['selluserid'].value.toString())", 
      "                    ^---- HERE" 
     ], 
     "script": "(doc['isshoper'].value == 0) || params.arrShopUser.get(doc['selluserid'].value.toString())", 
     "lang": "painless" 
     } 
    ], 
    "type": "search_phase_execution_exception", 
    "reason": "all shards failed", 
    "phase": "query", 
    "grouped": true, 
    "failed_shards": [ 
     { 
     "shard": 0, 
     "index": "tsy_trade", 
     "node": "1MbSaY-RR6GPgo_AI-g8GA", 
     "reason": { 
      "type": "script_exception", 
      "reason": "runtime error", 
      "script_stack": [ 
      "(doc['isshoper'].value == 0) || params.arrShopUser.get(doc['selluserid'].value.toString())", 
      "                    ^---- HERE" 
      ], 
      "script": "(doc['isshoper'].value == 0) || params.arrShopUser.get(doc['selluserid'].value.toString())", 
      "lang": "painless", 
      "caused_by": { 
      "type": "null_pointer_exception", 
      "reason": null 
      } 
     } 
     } 
    ] 
    }, 
    "status": 500 
} 
+0

경우,이는 실패 할 수 있습니다 '문서 ['selluserid를 '] .value.toString()' – Val

+0

어쨌든이 문제를 해결 하시겠습니까? Java 또는 Painless 언어에 익숙하지 않습니다. –

+0

모든 0과 Null 문서를 es에서 제외했지만 여전히이 오류를 보여줍니다. –

답변

0

대신이 스크립트를보십시오 :`selluserid`가 null 값 또는 0을 가지고

(doc['isshoper'].value == 0) || (doc['isshoper'].value == null) || params.arrShopUser.get(doc['selluserid'].value.toString()) 
+0

행운이 있나요? – Val

관련 문제