ElasticsearchParseException: Failed to derive xcontent

When you come across with this Exception. If you use spring-boot-starter-data-elasticsearch or spring-data-elasticsearch, it means that you have an error in your query string.
Below is my wrong expression.

@Query("\"multi_match\" : { \"query\" : \"?0\", \"fields\": [\"name^20\", \"cnName^10\", \"enName^10\", \"alias\"], \"type\": \"phrase\", \"slop\": 0}")
public List<TengXunActorElasticsearch> findByName(String str);

The correct one:

@Query("{\"multi_match\" : { \"query\" : \"?0\", \"fields\": [\"name^20\", \"cnName^10\", \"enName^10\", \"alias\"], \"type\": \"phrase\", \"slop\": 0}}")
public List<TengXunActorElasticsearch> findByName(String str);

Please check it carefully.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章