Hello,
Currently, I am in the midst of transitioning from Elasticsearch HLRC 6.8 to Elasticsearch REST API Java Client 8.7 within a Spring Boot application. This migration aligns with the broader upgrade of the Spring version from 5.5 to 6.1.
Following the upgrade to Spring version 6, I've observed widespread failures, ranging from Spring Data to Elasticsearch and the generation of Elasticsearch queries.
I haven't come across any comprehensive documentation that could provide assistance.
The following query is generated using Elasticsearch HLRC 6.8. Could you please guide me on how to generate this query using the Elasticsearch 8.7 Java REST API client?
{
"size": 0,
"query": {
"bool": {
"must": [
{
"bool": {
"should": [
{
"terms": {
"ex_desc": [
"bus"
],
"boost": 1.0
}
},
{
"terms": {
"ex_desc": [
"truck"
],
"boost": 1.0
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
},
{
"bool": {
"should": [
{
"bool": {
"must": [
{
"terms": {
"mstate": [
"OE"
],
"boost": 1.0
}
},
{
"bool": {
"should": [
{
"terms": {
"mtype": [
"GENERAL"
],
"boost": 1.0
}
},
{
"terms": {
"mtype": [
"Need to check"
],
"boost": 1.0
}
},
{
"terms": {
"mtype": [
"Unknown"
],
"boost": 1.0
}
},
{
"terms": {
"mtype": [
"NA"
],
"boost": 1.0
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
},
{
"terms": {
"mstatus": [
"Active now"
],
"boost": 1.0
}
},
{
"terms": {
"mstatus": [
"Unknown"
],
"boost": 1.0
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
}
],
"filter": [
{
"range": {
"spent_charges": {
"from": "0",
"to": null,
"include_lower": true,
"include_upper": true,
"boost": 1.0
}
}
},
{
"terms": {
"email.keyword": [
"abcm@ras.com",
"pjhsk@ras.com"
],
"boost": 1.0
}
},
{
"terms": {
"source": [
"SCR1",
"SCR2",
"SCR3",
"SCR4"
],
"boost": 1.0
}
},
{
"range": {
"start_date": {
"from": "2022-11-01",
"to": null,
"include_lower": true,
"include_upper": true,
"boost": 1.0
}
}
},
{
"terms": {
"deleted": [
"N"
],
"boost": 1.0
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
},
"aggregations": {
"unique_email": {
"cardinality": {
"field": "email.keyword"
}
},
"staff": {
"terms": {
"field": "email.keyword",
"size": 10000,
"min_doc_count": 1,
"shard_min_doc_count": 0,
"show_term_doc_count_error": false,
"order": [
{
"totalspent": "desc"
},
{
"_key": "asc"
}
]
},
"aggregations": {
"Num": {
"cardinality": {
"field": "number.keyword"
}
},
"totalexp": {
"sum": {
"field": "spent_charges"
}
},
"distinct": {
"top_hits": {
"from": 0,
"size": 1,
"version": false,
"seq_no_primary_term": false,
"explain": false,
"_source": {
"includes": [
"all_uid",
"name",
"age",
"email",
"status"
],
"excludes": []
}
}
},
"expsort": {
"bucket_sort": {
"sort": [],
"from": 0,
"size": 10,
"gap_policy": "SKIP"
}
}
}
}
}
}
Thanks in advance
Chetan