Skip to content

inner_hits breaks from version 1.7 to 2.3 upgrade #19142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
siddharthgoel88 opened this issue Jun 29, 2016 · 5 comments
Closed

inner_hits breaks from version 1.7 to 2.3 upgrade #19142

siddharthgoel88 opened this issue Jun 29, 2016 · 5 comments
Labels

Comments

@siddharthgoel88
Copy link

Elasticsearch version: 2.3.3

JVM version: 1.7.0_95

OS version: Red Hat Enterprise Linux Workstation release 6.7 (Santiago)

Description of the problem including expected versus actual behavior:

Steps to reproduce:
I have described the issue on community at https://discuss.elastic.co/t/inner-hits-queries-break-from-1-7-to-2-3-in-elasticsearch/54242 .

I had an inner_hits query which was working fine in version 1.7 but it stopped working in version 2.3.3. Following is the query :

"query": {
    "filtered": {
        "filter": {
            "and": [
                {
                    "range": {
                        "@timestamp": {
                             "gte": "2015-01-01||/d",
                             "lte": "2016-01-01||/d"
                        }
                    }
                },
                {
                    "or": [
                        {
                            "has_child": {
                                "type": "TypeName",
                                "filter": {
                                    "term": {
                                        "eventType.raw": "some-event"
                                    }
                                },
                                "inner_hits": {
                                    "_source": "@timestamp"
                                }
                            }
                        },
                        {
                            "not": {
                                "has_child": {
                                    "type": "TypeName",
                                    "filter": {
                                        "term": {
                                            "eventType.raw": "some-event"
                                        }
                                    },
                                    "inner_hits": {
                                        "_source": "@timestamp"
                                    }
                                }
                            }
                        }
                    ]
                }
            ]
        }
    }
}

With version 2.3.3 I get the following response for it :

"reason": {
   "type": "illegal_argument_exception",
   "reason": "inner_hit definition with the name [TypeName] already exists. Use a different inner_hit name"
}

Provide logs (if relevant):
Following is the error stack

nested: IllegalArgumentException[inner_hit definition with the name [TypeName] already exists. Use a different inner_hit name];
    at org.elasticsearch.search.SearchService.parseSource(SearchService.java:855)
    at org.elasticsearch.search.SearchService.createContext(SearchService.java:654)
    at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:620)
    at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:371)
    at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:368)
    at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:365)
    at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33)
    at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:75)
    at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:376)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: inner_hit definition with the name [TypeName] already exists. Use a different inner_hit name
    at org.elasticsearch.search.fetch.innerhits.InnerHitsContext.addInnerHitDefinition(InnerHitsContext.java:69)
    at org.elasticsearch.index.query.QueryParseContext.addInnerHits(QueryParseContext.java:218)
    at org.elasticsearch.index.query.HasChildQueryParser.parse(HasChildQueryParser.java:155)
    at org.elasticsearch.index.query.QueryParseContext.parseInnerFilter(QueryParseContext.java:277)
    at org.elasticsearch.index.query.NotQueryParser.parse(NotQueryParser.java:69)
    at org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:250)
    at org.elasticsearch.index.query.QueryParseContext.parseInnerFilter(QueryParseContext.java:263)
    at org.elasticsearch.index.query.OrQueryParser.parse(OrQueryParser.java:69)
    at org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:250)
    at org.elasticsearch.index.query.QueryParseContext.parseInnerFilter(QueryParseContext.java:263)
    at org.elasticsearch.index.query.AndQueryParser.parse(AndQueryParser.java:69)
    at org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:250)
    at org.elasticsearch.index.query.QueryParseContext.parseInnerFilter(QueryParseContext.java:263)
    at org.elasticsearch.index.query.FilteredQueryParser.parse(FilteredQueryParser.java:79)
    at org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:250)
    at org.elasticsearch.index.query.IndexQueryParserService.innerParse(IndexQueryParserService.java:320)
    at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:223)
    at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:218)
    at org.elasticsearch.search.query.QueryParseElement.parse(QueryParseElement.java:33)
    at org.elasticsearch.search.SearchService.parseSource(SearchService.java:838)
    ... 12 more



@siddharthgoel88
Copy link
Author

May be #16218 could give some more insight into this.

@dadoonet
Copy link
Member

@martijnvg suggested that we could come with a better error message: https://discuss.elastic.co/t/inner-hits-queries-break-from-1-7-to-2-3-in-elasticsearch/54242/4

Marking as "non issue"

@clintongormley
Copy link
Contributor

I think the exception is pretty clear already. No idea about how to improve it. Any suggestions?

@dadoonet
Copy link
Member

The thing is that the user did not explicitly define a name. It was inherited from the has_child query. So may be we could say something like

inner_hit definition with the name [TypeName] already exists. Use a different inner_hit name or define one explicitly.

@clintongormley
Copy link
Contributor

ah right, gotcha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants