Elasticsearch match nested field against array of values Elasticsearch match nested field against array of values elasticsearch elasticsearch

Elasticsearch match nested field against array of values


I think you would need to change your mappings for your nested types for this - the terms query only works on not_analyzed fields. If you update your mapping to something like:

elasticsearch!({    prefix_name: false,    index_name: 'documents',    index_options: {    mappings: {        document: {            properties: {                procuring_entity: {                    type: 'nested',                    properties: {                        country: {                            'type': 'string',                            'index': 'not_analyzed'                        }                    }                },                awards: {                    type: 'nested'                }            }        }    }    },    wrapper: :load})

I think the query should work if you do that.