Skip to content
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

No inner hits returned when nested query inside dismax query (v5) #23482

Closed
wboult opened this issue Mar 3, 2017 · 2 comments
Closed

No inner hits returned when nested query inside dismax query (v5) #23482

wboult opened this issue Mar 3, 2017 · 2 comments
Assignees
Labels
>bug good first issue low hanging fruit :Search/Search Search-related issues that do not fall into other categories

Comments

@wboult
Copy link

wboult commented Mar 3, 2017

Elasticsearch version:
5.2.1
Plugins installed: []
JVM version:
1.8
OS version:
NAME="Amazon Linux AMI"
VERSION="2016.09"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2016.09"
PRETTY_NAME="Amazon Linux AMI 2016.09"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2016.09:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
Amazon Linux AMI release 2016.09

Description of the problem including expected versus actual behavior:
I've just moved to elastic v5 (5.2.1) from 2.3.5 and am finding that I cannot get nested inner hits back when the nested query is placed inside a dismax query.

Steps to reproduce:

  1. Create new index with nested type
curl -XPUT localhost:9200/nested-dismax '{
  "mappings": {
    "tpe": {
      "properties": {
        "bob": {
          "type": "nested",
          "properties": {
            "name": {
              "type": "text"
            }
          }
        }
      }
    }
  }
}'
  1. Index a document:
curl -XPUT localhost:9200/nested-dismax/tpe/1 '{
  "bob" : {
    "name" : "Bob"
  }
}'
  1. Try a nested query without a dismax and it works:
curl -XGET localhost:9200/nested-dismax/_search '{
  "query": {
    "nested": {
      "path": "bob",
      "query": {
        "match": {
          "bob.name": "Bob"
        }
      },
      "inner_hits":{}
    }
  }
}'
  1. Try it with a dismax around it and no inner hits are returned:
curl -XGET localhost:9200/nested-dismax/_search '{
  "query": {
    "dis_max": {
      "queries": [
        {
          "nested": {
            "path": "bob",
            "query": {
              "match": {
                "bob.name": "Bob"
              }
            },
            "inner_hits": {}
          }
        }
      ]
    }
  }
}'

PS - apologies if the curls don't run straight away, I was using sense and my server got shut down before I could test the curl version!

@martijnvg martijnvg self-assigned this Mar 5, 2017
@martijnvg
Copy link
Member

@wboult Thanks for reporting this. Inner hits are indeed not working when nesting it under dis_max query.

@zahir-koradia
Copy link

I see the fix has been added to v6. Is it expected to be back ported to v5?

@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Inner Hits labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug good first issue low hanging fruit :Search/Search Search-related issues that do not fall into other categories
Projects
None yet
Development

No branches or pull requests

4 participants