0

I am using elasticsearch java Api and i am trying to run this query to retrieve results. But i am gettin a parsing exception. would you please help me to figure out where is the problem? I will be grateful

{
    "size": 0,
    "query": {
        "bool": {
            "must": [{
                    "query_string": {
                        "query": "data~ AND gaps~",
                        "default_field": "all_muses",
                        "fields": [],
                        "type": "best_fields",
                        "default_operator": "or",
                        "max_determinized_states": 10000,
                        "enable_position_increments": true,
                        "fuzziness": "AUTO",
                        "fuzzy_prefix_length": 0,
                        "fuzzy_max_expansions": 50,
                        "phrase_slop": 0,
                        "escape": false,
                        "auto_generate_synonyms_phrase_query": true,
                        "fuzzy_transpositions": true,
                        "boost": 1.0
                    }
                }
            ],
            "adjust_pure_negative": true,
            "boost": 1.0
        }
    },
    "aggregations": {
        "groupBySerie": {
            "terms": {
                "field": "titreSerie",
                "size": 6,
                "min_doc_count": 1,
                "shard_min_doc_count": 0,
                "show_term_doc_count_error": false,
                "order": [{
                        "_count": "desc"
                    }, {
                        "_key": "asc"
                    }
                ]
            },
            "aggregations": {
                "groupBySf": {
                    "terms": {
                        "field": "sousFamille",
                        "size": 10,
                        "min_doc_count": 1,
                        "shard_min_doc_count": 0,
                        "show_term_doc_count_error": false,
                        "execution_hint": "global_ordinals_low_cardinality",
                        "order": [{
                                "_count": "desc"
                            }, {
                                "_key": "asc"
                            }
                        ]
                    }
                }
            }
        }
    }
}

here is the exception i'am getting

ElasticsearchStatusException[Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]]; nested: ElasticsearchException[Elasticsearch exception 
[type=parse_exception, reason=parse_exception: Encountered " ":" ": "" at line 1, column 36.
20:55:55,464 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) Was expecting one of:
20:55:55,464 INFO  [stdout] (http-localhost/127.0.0.1:8080-3)     <NOT> ...
20:55:55,464 INFO  [stdout] (http-localhost/127.0.0.1:8080-3)     "+" ...
20:55:55,464 INFO  [stdout] (http-localhost/127.0.0.1:8080-3)     "-" ...
20:55:55,465 INFO  [stdout] (http-localhost/127.0.0.1:8080-3)     <BAREOPER> ...
20:55:55,465 INFO  [stdout] (http-localhost/127.0.0.1:8080-3)     "(" ...
20:55:55,465 INFO  [stdout] (http-localhost/127.0.0.1:8080-3)     "*" ...
20:55:55,465 INFO  [stdout] (http-localhost/127.0.0.1:8080-3)     <QUOTED> ...
20:55:55,465 INFO  [stdout] (http-localhost/127.0.0.1:8080-3)     <TERM> ...
20:55:55,465 INFO  [stdout] (http-localhost/127.0.0.1:8080-3)     <PREFIXTERM> ...
20:55:55,465 INFO  [stdout] (http-localhost/127.0.0.1:8080-3)     <WILDTERM> ...
20:55:55,465 INFO  [stdout] (http-localhost/127.0.0.1:8080-3)     <REGEXPTERM> ...
20:55:55,465 INFO  [stdout] (http-localhost/127.0.0.1:8080-3)     "[" ...
20:55:55,465 INFO  [stdout] (http-localhost/127.0.0.1:8080-3)     "{" ...
20:55:55,465 INFO  [stdout] (http-localhost/127.0.0.1:8080-3)     <NUMBER> ...
20:55:55,465 INFO  [stdout] (http-localhost/127.0.0.1:8080-3)     <TERM> ...
20:55:55,466 INFO  [stdout] (http-localhost/127.0.0.1:8080-3)     "*" ...
20:55:55,466 INFO  [stdout] (http-localhost/127.0.0.1:8080-3)     ]];

"I am using elasticsearch java Api and i am trying to run this query to retrieve results. But i am gettin a parsing exception. would you please help me to figure out where is the problem? I will be grateful"

alma elghoul
  • 183
  • 1
  • 2
  • 12

1 Answers1

0

The execution_hint parameter doesn't accept the global_ordinals_low_cardinality value, but only map and global_ordinals.

You need to make sure that the version of your client Java API is in synch with the version of your ES cluster, as it seems that you're using an old client Java API.

Val
  • 207,596
  • 13
  • 358
  • 360
  • hello it wasn't that the problem and the versions are the same – alma elghoul Mar 24 '21 at 09:19
  • What was the problem then? You tagged the question with elasticsearch-7 but are you running on a 6.x version? – Val Mar 24 '21 at 09:20
  • i didn't find yet the solution.yes it we work with the version 7.6 of elasticsearch. but the problem i think is in the ""query": "data~ AND gaps~"," when i search with one word i don't have the error? any idea why? i changed the default-operator to and but i get the same eror? – alma elghoul Mar 25 '21 at 09:03