Browse Source

Merge pull request #20794 from joshuar/doc/fix_highlighter_ambiguities

[DOCS] Use a better name for fields in examples to avoid ambiguity
Joshua Rich 9 years ago
parent
commit
cdb156e691
1 changed files with 37 additions and 37 deletions
  1. 37 37
      docs/reference/search/request/highlighting.asciidoc

+ 37 - 37
docs/reference/search/request/highlighting.asciidoc

@@ -15,14 +15,14 @@ GET /_search
     },
     },
     "highlight" : {
     "highlight" : {
         "fields" : {
         "fields" : {
-            "content" : {}
+            "comment" : {}
         }
         }
     }
     }
 }
 }
 --------------------------------------------------
 --------------------------------------------------
 // CONSOLE
 // CONSOLE
 
 
-In the above case, the `content` field will be highlighted for each
+In the above case, the `comment` field will be highlighted for each
 search hit (there will be another element in each search hit, called
 search hit (there will be another element in each search hit, called
 `highlight`, which includes the highlighted fields and the highlighted
 `highlight`, which includes the highlighted fields and the highlighted
 fragments).
 fragments).
@@ -71,14 +71,14 @@ natural languages, not as well with fields containing for instance html markup
 * Treats the document as the whole corpus, and scores individual sentences as
 * Treats the document as the whole corpus, and scores individual sentences as
 if they were documents in this corpus, using the  BM25 algorithm
 if they were documents in this corpus, using the  BM25 algorithm
 
 
-Here is an example of setting the `content` field in the index mapping to allow for
+Here is an example of setting the `comment` field in the index mapping to allow for
 highlighting using the postings highlighter on it:
 highlighting using the postings highlighter on it:
 
 
 [source,js]
 [source,js]
 --------------------------------------------------
 --------------------------------------------------
 {
 {
     "type_name" : {
     "type_name" : {
-        "content" : {"index_options" : "offsets"}
+        "comment" : {"index_options" : "offsets"}
     }
     }
 }
 }
 --------------------------------------------------
 --------------------------------------------------
@@ -113,7 +113,7 @@ will be used instead of the plain highlighter.  The fast vector highlighter:
   for things like phrase matches being sorted above term matches when
   for things like phrase matches being sorted above term matches when
   highlighting a Boosting Query that boosts phrase matches over term matches
   highlighting a Boosting Query that boosts phrase matches over term matches
 
 
-Here is an example of setting the `content` field to allow for
+Here is an example of setting the `comment` field to allow for
 highlighting using the fast vector highlighter on it (this will cause
 highlighting using the fast vector highlighter on it (this will cause
 the index to be bigger):
 the index to be bigger):
 
 
@@ -121,7 +121,7 @@ the index to be bigger):
 --------------------------------------------------
 --------------------------------------------------
 {
 {
     "type_name" : {
     "type_name" : {
-        "content" : {"term_vector" : "with_positions_offsets"}
+        "comment" : {"term_vector" : "with_positions_offsets"}
     }
     }
 }
 }
 --------------------------------------------------
 --------------------------------------------------
@@ -142,7 +142,7 @@ GET /_search
     },
     },
     "highlight" : {
     "highlight" : {
         "fields" : {
         "fields" : {
-            "content" : {"type" : "plain"}
+            "comment" : {"type" : "plain"}
         }
         }
     }
     }
 }
 }
@@ -163,7 +163,7 @@ GET /_search
     },
     },
     "highlight" : {
     "highlight" : {
         "fields" : {
         "fields" : {
-            "content" : {"force_source" : true}
+            "comment" : {"force_source" : true}
         }
         }
     }
     }
 }
 }
@@ -241,7 +241,7 @@ GET /_search
     "highlight" : {
     "highlight" : {
         "tags_schema" : "styled",
         "tags_schema" : "styled",
         "fields" : {
         "fields" : {
-            "content" : {}
+            "comment" : {}
         }
         }
     }
     }
 }
 }
@@ -271,7 +271,7 @@ GET /_search
     },
     },
     "highlight" : {
     "highlight" : {
         "fields" : {
         "fields" : {
-            "content" : {"fragment_size" : 150, "number_of_fragments" : 3}
+            "comment" : {"fragment_size" : 150, "number_of_fragments" : 3}
         }
         }
     }
     }
 }
 }
@@ -294,7 +294,7 @@ GET /_search
     "highlight" : {
     "highlight" : {
         "order" : "score",
         "order" : "score",
         "fields" : {
         "fields" : {
-            "content" : {"fragment_size" : 150, "number_of_fragments" : 3}
+            "comment" : {"fragment_size" : 150, "number_of_fragments" : 3}
         }
         }
     }
     }
 }
 }
@@ -317,7 +317,7 @@ GET /_search
     "highlight" : {
     "highlight" : {
         "fields" : {
         "fields" : {
             "_all" : {},
             "_all" : {},
-            "bio.title" : {"number_of_fragments" : 0}
+            "blog.title" : {"number_of_fragments" : 0}
         }
         }
     }
     }
 }
 }
@@ -345,7 +345,7 @@ GET /_search
     },
     },
     "highlight" : {
     "highlight" : {
         "fields" : {
         "fields" : {
-            "content" : {
+            "comment" : {
                 "fragment_size" : 150,
                 "fragment_size" : 150,
                 "number_of_fragments" : 3,
                 "number_of_fragments" : 3,
                 "no_match_size": 150
                 "no_match_size": 150
@@ -375,7 +375,7 @@ GET /_search
     "stored_fields": [ "_id" ],
     "stored_fields": [ "_id" ],
     "query" : {
     "query" : {
         "match": {
         "match": {
-            "content": {
+            "comment": {
                 "query": "foo bar"
                 "query": "foo bar"
             }
             }
         }
         }
@@ -385,7 +385,7 @@ GET /_search
         "query": {
         "query": {
             "rescore_query" : {
             "rescore_query" : {
                 "match_phrase": {
                 "match_phrase": {
-                    "content": {
+                    "comment": {
                         "query": "foo bar",
                         "query": "foo bar",
                         "slop": 1
                         "slop": 1
                     }
                     }
@@ -397,21 +397,21 @@ GET /_search
     "highlight" : {
     "highlight" : {
         "order" : "score",
         "order" : "score",
         "fields" : {
         "fields" : {
-            "content" : {
+            "comment" : {
                 "fragment_size" : 150,
                 "fragment_size" : 150,
                 "number_of_fragments" : 3,
                 "number_of_fragments" : 3,
                 "highlight_query": {
                 "highlight_query": {
                     "bool": {
                     "bool": {
                         "must": {
                         "must": {
                             "match": {
                             "match": {
-                                "content": {
+                                "comment": {
                                     "query": "foo bar"
                                     "query": "foo bar"
                                 }
                                 }
                             }
                             }
                         },
                         },
                         "should": {
                         "should": {
                             "match_phrase": {
                             "match_phrase": {
-                                "content": {
+                                "comment": {
                                     "query": "foo bar",
                                     "query": "foo bar",
                                     "slop": 1,
                                     "slop": 1,
                                     "boost": 10.0
                                     "boost": 10.0
@@ -452,9 +452,9 @@ GET /_search
         "fragment_size" : 150,
         "fragment_size" : 150,
         "fields" : {
         "fields" : {
             "_all" : { "pre_tags" : ["<em>"], "post_tags" : ["</em>"] },
             "_all" : { "pre_tags" : ["<em>"], "post_tags" : ["</em>"] },
-            "bio.title" : { "number_of_fragments" : 0 },
-            "bio.author" : { "number_of_fragments" : 0 },
-            "bio.content" : { "number_of_fragments" : 5, "order" : "score" }
+            "blog.title" : { "number_of_fragments" : 0 },
+            "blog.author" : { "number_of_fragments" : 0 },
+            "blog.comment" : { "number_of_fragments" : 5, "order" : "score" }
         }
         }
     }
     }
 }
 }
@@ -508,8 +508,8 @@ ways.  All `matched_fields` must have `term_vector` set to
 combined is loaded so only that field would benefit from having
 combined is loaded so only that field would benefit from having
 `store` set to `yes`.
 `store` set to `yes`.
 
 
-In the following examples `content` is analyzed by the `english`
-analyzer and `content.plain` is analyzed by the `standard` analyzer.
+In the following examples `comment` is analyzed by the `english`
+analyzer and `comment.plain` is analyzed by the `standard` analyzer.
 
 
 [source,js]
 [source,js]
 --------------------------------------------------
 --------------------------------------------------
@@ -517,15 +517,15 @@ GET /_search
 {
 {
     "query": {
     "query": {
         "query_string": {
         "query_string": {
-            "query": "content.plain:running scissors",
-            "fields": ["content"]
+            "query": "comment.plain:running scissors",
+            "fields": ["comment"]
         }
         }
     },
     },
     "highlight": {
     "highlight": {
         "order": "score",
         "order": "score",
         "fields": {
         "fields": {
-            "content": {
-                "matched_fields": ["content", "content.plain"],
+            "comment": {
+                "matched_fields": ["comment", "comment.plain"],
                 "type" : "fvh"
                 "type" : "fvh"
             }
             }
         }
         }
@@ -546,14 +546,14 @@ GET /_search
     "query": {
     "query": {
         "query_string": {
         "query_string": {
             "query": "running scissors",
             "query": "running scissors",
-            "fields": ["content", "content.plain^10"]
+            "fields": ["comment", "comment.plain^10"]
         }
         }
     },
     },
     "highlight": {
     "highlight": {
         "order": "score",
         "order": "score",
         "fields": {
         "fields": {
-            "content": {
-                "matched_fields": ["content", "content.plain"],
+            "comment": {
+                "matched_fields": ["comment", "comment.plain"],
                 "type" : "fvh"
                 "type" : "fvh"
             }
             }
         }
         }
@@ -572,14 +572,14 @@ GET /_search
     "query": {
     "query": {
         "query_string": {
         "query_string": {
             "query": "running scissors",
             "query": "running scissors",
-            "fields": ["content", "content.plain^10"]
+            "fields": ["comment", "comment.plain^10"]
         }
         }
     },
     },
     "highlight": {
     "highlight": {
         "order": "score",
         "order": "score",
         "fields": {
         "fields": {
-            "content": {
-                "matched_fields": ["content.plain"],
+            "comment": {
+                "matched_fields": ["comment.plain"],
                 "type" : "fvh"
                 "type" : "fvh"
             }
             }
         }
         }
@@ -590,7 +590,7 @@ GET /_search
 
 
 The above query wouldn't highlight "run" or "scissor" but shows that
 The above query wouldn't highlight "run" or "scissor" but shows that
 it is just fine not to list the field to which the matches are combined
 it is just fine not to list the field to which the matches are combined
-(`content`) in the matched fields.
+(`comment`) in the matched fields.
 
 
 [NOTE]
 [NOTE]
 Technically it is also fine to add fields to `matched_fields` that
 Technically it is also fine to add fields to `matched_fields` that
@@ -606,7 +606,7 @@ There is a small amount of overhead involved with setting
 --------------------------------------------------
 --------------------------------------------------
     "highlight": {
     "highlight": {
         "fields": {
         "fields": {
-            "content": {}
+            "comment": {}
         }
         }
     }
     }
 --------------------------------------------------
 --------------------------------------------------
@@ -615,8 +615,8 @@ to
 --------------------------------------------------
 --------------------------------------------------
     "highlight": {
     "highlight": {
         "fields": {
         "fields": {
-            "content": {
-                "matched_fields": ["content"],
+            "comment": {
+                "matched_fields": ["comment"],
                 "type" : "fvh"
                 "type" : "fvh"
             }
             }
         }
         }