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.

你可能感兴趣的:(java,elasticsearch)