Java.lang.illegalstateexception: unexpected byte [0x02] elasticsearch

I am facing above error in spring data elastic search . how to parse simple query string in query builder? my code is

final QueryBuilder searchquery = QueryBuilders.boolQuery()
.should(QueryBuilders.simpleQueryStringQuery(text)
.field("question")
.lenient(true));

    final NativeSearchQuery build = new NativeSearchQueryBuilder().withQuery(searchquery)
            .withPageable(PageRequest.of(0, 5))
            .build();

    final List<FaqTranslationEntity> questions = this.elasticsearchTemplate.queryForList(build, FaqTranslationEntity.class);

Is the text encoded with UTF8?

no it's simple string

Could you share it and share a sample project which reproduces the problem?

i have share DSL query code above plz check . is this queryBuilder parsing error ? what is solution. same code works for queryStringQuery but for simpleQueryStringQuery fails.

I can't tell without being able to see or reproduce what is happening.

You did not share the content of text.

Could you also share the output of:

GET /yourindexname/_search?q=text 

Where you replace yourindexname and text.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.