Skip to content

Repeating A Functional Search Query Results In Permanent Errors Until Restarting ES #23280

@neoform

Description

@neoform

Elasticsearch version: 5.2.1

Plugins installed: []

JVM version: 1.8.0_121

OS version: Debian 8

Description of the problem including expected versus actual behavior:

Steps to reproduce:

  1. Execute Search Query (below), valid results returned.
  2. Repeat step Query DSL: Terms Filter #1 more than 3 times.
  3. Error message is shown.
  4. Restart ElasticSearch.
  5. Repeat step Query DSL: Terms Filter #1.

Provide logs (if relevant):

[2017-02-21 02:48:41] log.INFO: Request Success: {"method":"POST","uri":"http://127.0.0.1:9200/product/product/_search?timeout=6s&from=0&size=40","headers":{"host":["127.0.0.1:9200"],"user-agent":["Guzzle/3.9.2 curl/7.38.0 PHP/7.0.16-1~dotdeb+8.1"],"content-length":[1570]},"HTTP code":200,"duration":0.080847} {"file":"/var/www/xxxx/library/Elasticsearch/Connections/AbstractConnection.php","line":131,"class":"Elasticsearch\Connections\AbstractConnection","function":"logRequestSuccess"}

[2017-02-21 02:48:42] log.WARNING: Request Failure: {"method":"POST","uri":"http://127.0.0.1:9200/product/product/_search?timeout=6s&from=0&size=40","headers":{"host":["127.0.0.1:9200"],"user-agent":["Guzzle/3.9.2 curl/7.38.0 PHP/7.0.16-1~dotdeb+8.1"],"content-length":[1570]},"HTTP code":500,"duration":0.08146,"error":"Server error response\n[status code] 500\n[reason phrase] Internal Server Error\n[url] http://127.0.0.1:9200/product/product/_search?timeout=6s&from=0&size=40"} {"file":"/var/www/xxxx/library/Elasticsearch/Connections/AbstractConnection.php","line":186,"class":"Elasticsearch\Connections\AbstractConnection","function":"logRequestFail"}

[2017-02-21 02:48:42] log.WARNING: Response ["{"error":{"root_cause":[{"type":"illegal_state_exception","reason":"Child query must not match same docs with parent filter. Combine them as must clauses (+) to find a problem doc. docId=2147483647, class org.apache.lucene.search.ConjunctionScorer"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query_fetch","grouped":true,"failed_shards":[{"shard":0,"index":"product","node":"ddjlYjROS8e3YTe4HT730A","reason":{"type":"illegal_state_exception","reason":"Child query must not match same docs with parent filter. Combine them as must clauses (+) to find a problem doc. docId=2147483647, class org.apache.lucene.search.ConjunctionScorer"}}],"caused_by":{"type":"illegal_state_exception","reason":"Child query must not match same docs with parent filter. Combine them as must clauses (+) to find a problem doc. docId=2147483647, class org.apache.lucene.search.ConjunctionScorer"}},"status":500}"] {"file":"/var/www/xxxx/library/Elasticsearch/Connections/AbstractConnection.php","line":189,"class":"Elasticsearch\Connections\AbstractConnection","function":"logRequestFail"}

[2017-02-21 02:48:42] log.ERROR: 500 Server Exception: Server error response [status code] 500 [reason phrase] Internal Server Error [url] http://127.0.0.1:9200/product/product/_search?timeout=6s&from=0&size=40 {"error":{"root_cause":[{"type":"illegal_state_exception","reason":"Child query must not match same docs with parent filter. Combine them as must clauses (+) to find a problem doc. docId=2147483647, class org.apache.lucene.search.ConjunctionScorer"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query_fetch","grouped":true,"failed_shards":[{"shard":0,"index":"product","node":"ddjlYjROS8e3YTe4HT730A","reason":{"type":"illegal_state_exception","reason":"Child query must not match same docs with parent filter. Combine them as must clauses (+) to find a problem doc. docId=2147483647, class org.apache.lucene.search.ConjunctionScorer"}}],"caused_by":{"type":"illegal_state_exception","reason":"Child query must not match same docs with parent filter. Combine them as must clauses (+) to find a problem doc. docId=2147483647, class org.apache.lucene.search.ConjunctionScorer"}},"status":500} [] {"file":"/var/www/xxxx/library/Elasticsearch/Connections/GuzzleConnection.php","line":229,"class":"Elasticsearch\Connections\GuzzleConnection","function":"process5xxError"}

Query:

{
    "timeout": "6s",
    "index": "product",
    "type": "product",
    "from": 0,
    "size": 40,
    "body": {
        "_source": [
            "mpn",
            "cheapest_product_id",
            "price",
            "price_discount_percent",
            "price_discount_amount",
            "product_count",
            "rank_weight",
            "product.id",
            "product.price",
            "product.status_id"
        ],
        "query": {
            "function_score": {
                "query": {
                    "bool": {
                        "filter": [
                            {
                                "nested": {
                                    "path": "product",
                                    "query": {
                                        "bool": {
                                            "filter": [
                                                {
                                                    "term": {
                                                        "product.status_id": 1
                                                    }
                                                },
                                                {
                                                    "nested": {
                                                        "path": "product.category",
                                                        "query": {
                                                            "bool": {
                                                                "filter": [
                                                                    {
                                                                        "terms": {
                                                                            "product.category.id": [
                                                                                870
                                                                            ]
                                                                        }
                                                                    }
                                                                ]
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "nested": {
                                                        "path": "product.brand",
                                                        "query": {
                                                            "bool": {
                                                                "filter": [
                                                                    {
                                                                        "terms": {
                                                                            "product.brand.id": [
                                                                                23083
                                                                            ]
                                                                        }
                                                                    }
                                                                ]
                                                            }
                                                        }
                                                    }
                                                }
                                            ],
                                            "must": [
                                                {
                                                    "multi_match": {
                                                        "query": "television, audio, phone, dvd, tv",
                                                        "fields": [
                                                            "product.name^10",
                                                            "product.description^4",
                                                            "product.brand.name",
                                                            "product.brand.keywords_internal",
                                                            "product.brand.keywords_external"
                                                        ],
                                                        "minimum_should_match": 0
                                                    }
                                                }
                                            ]
                                        }
                                    }
                                }
                            }
                        ]
                    }
                },
                "functions": [
                    {
                        "field_value_factor": {
                            "field": "product_count",
                            "factor": 50,
                            "modifier": "log1p"
                        }
                    },
                    {
                        "field_value_factor": {
                            "field": "rank_weight",
                            "modifier": "reciprocal",
                            "missing": 1
                        }
                    }
                ]
            }
        },
        "aggs": {
            "brands": {
                "nested": {
                    "path": "product.brand"
                },
                "aggs": {
                    "brands": {
                        "filter": {
                            "bool": {
                                "filter": [
                                    {
                                        "nested": {
                                            "path": "product",
                                            "query": {
                                                "bool": {
                                                    "filter": [
                                                        {
                                                            "term": {
                                                                "product.status_id": 1
                                                            }
                                                        },
                                                        {
                                                            "nested": {
                                                                "path": "product.category",
                                                                "query": {
                                                                    "bool": {
                                                                        "filter": [
                                                                            {
                                                                                "terms": {
                                                                                    "product.category.id": [
                                                                                        870
                                                                                    ]
                                                                                }
                                                                            }
                                                                        ]
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    ],
                                                    "must": [
                                                        {
                                                            "multi_match": {
                                                                "query": "television, audio, phone, dvd, tv",
                                                                "fields": [
                                                                    "product.name^10",
                                                                    "product.description^4",
                                                                    "product.brand.name",
                                                                    "product.brand.keywords_internal",
                                                                    "product.brand.keywords_external"
                                                                ],
                                                                "minimum_should_match": 0
                                                            }
                                                        }
                                                    ]
                                                }
                                            }
                                        }
                                    }
                                ]
                            }
                        },
                        "aggs": {
                            "brands": {
                                "terms": {
                                    "field": "product.brand.id",
                                    "size": 30
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

After the first few executions:

{
    "took": 156,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "failed": 0
    },
    "hits": {
        "total": 854,
        "max_score": 0,
        "hits": [ ... ]
    }
}

Then on the 3rd try:

{
    "error": {
        "root_cause": [
            {
                "type": "illegal_state_exception",
                "reason": "Child query must not match same docs with parent filter. Combine them as must clauses (+) to find a problem doc. docId=2147483647, class org.apache.lucene.search.ConjunctionScorer"
            }
        ],
        "type": "search_phase_execution_exception",
        "reason": "all shards failed",
        "phase": "query_fetch",
        "grouped": true,
        "failed_shards": [
            {
                "shard": 0,
                "index": "product",
                "node": "ddjlYjROS8e3YTe4HT730A",
                "reason": {
                    "type": "illegal_state_exception",
                    "reason": "Child query must not match same docs with parent filter. Combine them as must clauses (+) to find a problem doc. docId=2147483647, class org.apache.lucene.search.ConjunctionScorer"
                }
            }
        ],
        "caused_by": {
            "type": "illegal_state_exception",
            "reason": "Child query must not match same docs with parent filter. Combine them as must clauses (+) to find a problem doc. docId=2147483647, class org.apache.lucene.search.ConjunctionScorer"
        }
    },
    "status": 500
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search/SearchSearch-related issues that do not fall into other categories>bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions