# Error when searching specific fields in Rails

**URL:** <https://discuss.elastic.co/t/error-when-searching-specific-fields-in-rails/53848>\
**Category:** Elasticsearch\
**Created:** [June 24, 2016, 5:11am UTC](https://discuss.elastic.co/t/error-when-searching-specific-fields-in-rails/53848 "2016-06-24T05:11:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![emplumb](https://avatars.discourse-cdn.com/v4/letter/e/7cd45c/32.png) [@emplumb](https://discuss.elastic.co/u/emplumb)\
**Post date:** [June 24, 2016, 5:11am UTC](https://discuss.elastic.co/t/error-when-searching-specific-fields-in-rails/53848/1 "2016-06-24T05:11:49Z")

</div>

I'm pretty new to this so bear with me. Everything seems to work except I can't figure out how to prevent the `:p_s`, `:gender`, and `:part_of_speech` fields from showing in the search results.

[This article](https://www.elastic.co/guide/en/elasticsearch/guide/current/mapping-intro.html) says I need to indicate `no` somewhere so the fields aren't searchable. How do I implement this in the code below? Please let me know if you need more info.

And to be clear, removing those three fields from the `indexes` portion below doesn't work. I just added them for sake of illustration.

```
require 'elasticsearch/model'

class Term < ActiveRecord::Base
 ...

    mappings dynamic: 'false' do
      indexes :id, index: :not_analyzed
      indexes :name, Index: spanish_analyzer
      indexes :p_s
      indexes :gender
      indexes :part_of_speech
      indexes :definition, analyzer: :combined_analyzer
      indexes :etymology1, analyzer: :combined_analyzer
      indexes :etymology2, analyzer: :combined_analyzer
      indexes :uses, analyzer: :combined_analyzer
      indexes :notes1, analyzer: :combined_analyzer
      indexes :notes2, analyzer: :combined_analyzer
    end
  end

  def self.search(query)
    __elasticsearch__.search(
      {
        query: {
          multi_match: {
            query: query,
            fields: ['name^7', 'definition^6', 'etymology1^5', 'etymology2^4', 'uses^3', 'notes1^2', 'notes2^1'],
            operator: 'and'
          }
        }
      }
    )
  end
end
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:40pm UTC](https://discuss.elastic.co/t/error-when-searching-specific-fields-in-rails/53848/2 "2017-07-05T22:40:38Z")

</div>

Closed on July 5, 2017, 10:40pm UTC


