Hi,

elasticsearc has two ways to index inner json documents, one is called
"object"[0] (which is the default) and the other is called "nested"[1]. You
need to have the `itemResults` field mapped as `nested` in your mappings.

[0]
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-object-type.html
[1]
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-nested-type.html

On Tue, Oct 14, 2014 at 12:00 PM, shekhar chauhan <
[email protected]> wrote:

> Hi all,
>  I am new to elastic search.I am using nested filter query.this query is
> giving error "failed to find nested object under path [itemResults]]".
>
> my document structure is -
>
> {
>    "_id": "inspectionresults-07d864fd-76ec-427a-a1c6-b70e420ce3d8",
>    "_rev": "12-64c44ddcfcd477dfa86cdb9d3c659748",
>    "sectionResults": [
>
>        {
>            "SectionName": "More Details",
>            "itemResults": [
>
>                {
>                    "InspectionItem": "Launch Month",
>                    "ItemInfo": ""
>
>                }
>            ]
>        }
>
>    ]
> }
>
> and my query is -
>
> {
>   "query": {
>     "filtered": {
>       "query": {
>         "match_all": {}
>       },
>       "filter": {
>         "nested": {
>           "path": "itemResults",
>           "filter": {
>             "bool": {
>               "must": [
>                 {
>                   "term": {
>                     "itemResults.InspectionItem": "Launch Month"
>                   }
>                 }
>               ]
>             }
>           }
>         }
>         }
>       }
>     }
>   }
>
> Error - "failed to find nested object under path [itemResults]]"
>
> But as you are seeing in document itemResults is already nested object.
> Please reply.
> Thanks in advance,
>
>  --
> You received this message because you are subscribed to the Google Groups
> "elasticsearch" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/a38b570f-64ac-44e6-8424-59ffb6bafa52%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/a38b570f-64ac-44e6-8424-59ffb6bafa52%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Adrien Grand

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j41Ewx-Kui_bxtjDotnktC7a29Q3bw2umH_7qERQ9MVhw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to