{"action":"opened","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch-rails/issues/356","labels_url":"https://api.github.com/repos/elastic/elasticsearch-rails/issues/356/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch-rails/issues/356/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch-rails/issues/356/events","html_url":"https://github.com/elastic/elasticsearch-rails/issues/356","id":64659091,"number":356,"title":"Search not querying fields included in index as part of associations","user":{"login":"jraczak","id":1156584,"avatar_url":"https://avatars.githubusercontent.com/u/1156584?v=3","gravatar_id":"","url":"https://api.github.com/users/jraczak","html_url":"https://github.com/jraczak","followers_url":"https://api.github.com/users/jraczak/followers","following_url":"https://api.github.com/users/jraczak/following{/other_user}","gists_url":"https://api.github.com/users/jraczak/gists{/gist_id}","starred_url":"https://api.github.com/users/jraczak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jraczak/subscriptions","organizations_url":"https://api.github.com/users/jraczak/orgs","repos_url":"https://api.github.com/users/jraczak/repos","events_url":"https://api.github.com/users/jraczak/events{/privacy}","received_events_url":"https://api.github.com/users/jraczak/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-26T23:56:22Z","updated_at":"2015-03-26T23:56:22Z","closed_at":null,"body":"My primary search needs to query against content that is derived from multiple associations in addition to values provided by a given record's database values. Checking the index configuration via `object.as_indexed_json` validates the data I'm looking for is being properly indexed. Below is the configuration for the indexing.\r\n\r\n    def as_indexed_json(options={})\r\n      self.as_json({ \r\n        only: [:name, :properties],\r\n        include: {\r\n\t      venue_subcategory: { only: :name },\r\n\t      tips: { only: :text }\r\n        }\r\n      })\r\n    end\r\n\r\nChecking a record with `object.as_indexed_json` returns the following.\r\n\r\n     => {\"name\"=>\"Spring\", \"properties\"=>\"--- {}\\n\", :venue_subcategory=>{\"name\"=>\"Restaurant\"}, :tips=>[{\"text\"=>\"Try the 1000 island sauce. It's better then cheese.\"}, {\"text\"=>\"Best spicy onion rings in all of New York. They are extra deep fried.\"}]}\r\n\r\nNote that all expected values are present in the JSON representation of the entry. To this point I assume I have everything configured correctly. However, a query for `'1000 island sauce'` returns several entries with partial matches but does not return the entry for Spring, which has '1000 island sauce' present in the text value for one of the indexed tips. Here is my query configuration.\r\n\r\n    def self.search(query)\r\n      __elasticsearch__.search(\r\n        {\r\n\t        query: {\r\n\t\t        multi_match: {\r\n\t\t\t        query: query,\r\n\t\t\t        fields: ['name^5', 'properties^3', 'tips[\"text\"]', 'venue_subcategory'],\r\n\t\t        }\r\n\t        }\r\n        }\r\n      )\r\n    end\r\n\r\nWithin the `fields` configuration I've also defined tips as `'tips'` and `'tips.text'` with no success. I'm not sure how to point the query at fields/values that are provided as part of indexing associated objects. \r\n\r\nThanks in advance for any help and insight."}}