index.asciidoc 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. [[mapping-index]]
  2. === `index`
  3. The `index` option controls how field values are indexed and, thus, how they
  4. are searchable. It accepts three values:
  5. [horizontal]
  6. `no`::
  7. Do not add this field value to the index. With this setting, the field
  8. will not be queryable.
  9. `not_analyzed`::
  10. Add the field value to the index unchanged, as a single term. This is the
  11. default for all fields that support this option except for
  12. <<string,`string`>> fields. `not_analyzed` fields are usually used with
  13. <<term-level-queries,term-level queries>> for structured search.
  14. `analyzed`::
  15. This option applies only to `string` fields, for which it is the default.
  16. The string field value is first <<analysis,analyzed>> to convert the
  17. string into terms (e.g. a list of individual words), which are then
  18. indexed. At search time, the the query string is passed through
  19. (<<search-analyzer,usually>>) the same analyzer to generate terms
  20. in the same format as those in the index. It is this process that enables
  21. <<full-text-queries,full text search>>.
  22. For example, you can create a `not_analyzed` string field with the following:
  23. [source,js]
  24. --------------------------------------------------
  25. PUT /my_index
  26. {
  27. "mappings": {
  28. "my_type": {
  29. "properties": {
  30. "status_code": {
  31. "type": "string",
  32. "index": "not_analyzed"
  33. }
  34. }
  35. }
  36. }
  37. }
  38. --------------------------------------------------
  39. // AUTOSENSE