From acdf2a582535750312b936c0fba5314975381178 Mon Sep 17 00:00:00 2001 From: Clinton Gormley Date: Tue, 21 Jan 2014 16:30:32 +0100 Subject: [PATCH] [SPEC] Renamed termvectors.* to termvector and mtermvectors and fixed the YAML syntax errors --- ...lti_termvectors.json => mtermvectors.json} | 13 +-- ...s.get_termvectors.json => termvector.json} | 2 +- rest-api-spec/test/mtermvectors/10_basic.yaml | 85 +++++++++++++++ .../10_basic.yaml | 21 ++-- .../10_basic.yaml | 101 ------------------ 5 files changed, 100 insertions(+), 122 deletions(-) rename rest-api-spec/api/{termvectors.get_multi_termvectors.json => mtermvectors.json} (92%) rename rest-api-spec/api/{termvectors.get_termvectors.json => termvector.json} (98%) create mode 100644 rest-api-spec/test/mtermvectors/10_basic.yaml rename rest-api-spec/test/{termvectors.get_termvectors => termvector}/10_basic.yaml (64%) delete mode 100644 rest-api-spec/test/termvectors.get_multi_termvectors/10_basic.yaml diff --git a/rest-api-spec/api/termvectors.get_multi_termvectors.json b/rest-api-spec/api/mtermvectors.json similarity index 92% rename from rest-api-spec/api/termvectors.get_multi_termvectors.json rename to rest-api-spec/api/mtermvectors.json index b61d90aae3d..4cac036d784 100644 --- a/rest-api-spec/api/termvectors.get_multi_termvectors.json +++ b/rest-api-spec/api/mtermvectors.json @@ -1,6 +1,6 @@ { - "termvectors.get_multi_termvectors" : { - "documentation" : "http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-termvectors.html", + "mtermvectors" : { + "documentation" : "http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html", "methods" : ["GET", "POST"], "url" : { "path" : "/_mtermvectors", @@ -8,18 +8,15 @@ "parts" : { "index" : { "type" : "string", - "description" : "The index in which the document resides.", - "required" : true + "description" : "The index in which the document resides." }, "type" : { "type" : "string", - "description" : "The type of the document.", - "required" : true + "description" : "The type of the document." }, "id" : { "type" : "string", - "description" : "The id of the document.", - "required" : true + "description" : "The id of the document." } }, "params" : { diff --git a/rest-api-spec/api/termvectors.get_termvectors.json b/rest-api-spec/api/termvector.json similarity index 98% rename from rest-api-spec/api/termvectors.get_termvectors.json rename to rest-api-spec/api/termvector.json index 0dfc1cd19d0..fda1c4aa523 100644 --- a/rest-api-spec/api/termvectors.get_termvectors.json +++ b/rest-api-spec/api/termvector.json @@ -1,5 +1,5 @@ { - "termvectors.get_termvector" : { + "termvector" : { "documentation" : "http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-termvectors.html", "methods" : ["GET", "POST"], "url" : { diff --git a/rest-api-spec/test/mtermvectors/10_basic.yaml b/rest-api-spec/test/mtermvectors/10_basic.yaml new file mode 100644 index 00000000000..53005b0af8e --- /dev/null +++ b/rest-api-spec/test/mtermvectors/10_basic.yaml @@ -0,0 +1,85 @@ +setup: + - do: + indices.create: + index: testidx + body: + mappings: + testtype: + properties: + text: + type : "string" + term_vector : "with_positions_offsets" + - do: + index: + index: testidx + type: testtype + id: testing_document + body: {"text" : "The quick brown fox is brown."} + + - do: + indices.refresh: {} + +--- +"Basic tests for multi termvector get": + + - do: + mtermvectors: + "term_statistics" : true + "body" : + "docs": + - + "_index" : "testidx" + "_type" : "testtype" + "_id" : "testing_document" + + - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} + - match: {docs.0.term_vectors.text.terms.brown.ttf: 2} + + - do: + mtermvectors: + "term_statistics" : true + "body" : + "docs": + - + "_index" : "testidx" + "_type" : "testtype" + "_id" : "testing_document" + + - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} + - match: {docs.0.term_vectors.text.terms.brown.ttf: 2} + + - do: + mtermvectors: + "term_statistics" : true + "index" : "testidx" + "body" : + "docs": + - + "_type" : "testtype" + "_id" : "testing_document" + + - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} + - match: {docs.0.term_vectors.text.terms.brown.ttf: 2} + + - do: + mtermvectors: + "term_statistics" : true + "index" : "testidx" + "type" : "testtype" + "body" : + "docs": + - + "_id" : "testing_document" + + - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} + - match: {docs.0.term_vectors.text.terms.brown.ttf: 2} + + - do: + mtermvectors: + "term_statistics" : true + "index" : "testidx" + "type" : "testtype" + "ids" : ["testing_document"] + + - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} + - match: {docs.0.term_vectors.text.terms.brown.ttf: 2} diff --git a/rest-api-spec/test/termvectors.get_termvectors/10_basic.yaml b/rest-api-spec/test/termvector/10_basic.yaml similarity index 64% rename from rest-api-spec/test/termvectors.get_termvectors/10_basic.yaml rename to rest-api-spec/test/termvector/10_basic.yaml index c05c036e908..998c5671113 100644 --- a/rest-api-spec/test/termvectors.get_termvectors/10_basic.yaml +++ b/rest-api-spec/test/termvector/10_basic.yaml @@ -1,32 +1,29 @@ setup: - do: - indices.create: + indices.create: index: testidx body: mappings: - testtype: { - "properties": { - "text": { - "type" : "string", + testtype: + "properties": + "text": + "type" : "string" "term_vector" : "with_positions_offsets" - } - } - } - do: index: index: testidx type: testtype id: testing_document body: - {"text" : "The quick brown fox is brown."} + "text" : "The quick brown fox is brown." - do: indices.refresh: {} --- -"Basic tests for termvectors get": +"Basic tests for termvector get": - do: - termvectors.get_termvector: + termvector: index: testidx type: testtype id: testing_document @@ -35,4 +32,4 @@ setup: - match: {term_vectors.text.field_statistics.sum_doc_freq: 5} - match: {term_vectors.text.terms.brown.doc_freq: 1} - - match: {term_vectors.text.terms.brown.tokens.0.start_offset: 10} \ No newline at end of file + - match: {term_vectors.text.terms.brown.tokens.0.start_offset: 10} diff --git a/rest-api-spec/test/termvectors.get_multi_termvectors/10_basic.yaml b/rest-api-spec/test/termvectors.get_multi_termvectors/10_basic.yaml deleted file mode 100644 index caf09533dad..00000000000 --- a/rest-api-spec/test/termvectors.get_multi_termvectors/10_basic.yaml +++ /dev/null @@ -1,101 +0,0 @@ -setup: - - do: - indices.create: - index: testidx - body: - mappings: - testtype: { - "properties": { - "text": { - "type" : "string", - "term_vector" : "with_positions_offsets" - } - } - } - - do: - index: - index: testidx - type: testtype - id: testing_document - body: - {"text" : "The quick brown fox is brown."} - - - do: - indices.refresh: {} - ---- -"Basic tests for multi termvector get": - - - do: - termvectors.get_multi_termvectors: - "term_statistics" : true - "body" : { - "docs": [ - { - "_index" : "testidx", - "_type" : "testtype", - "_id" : "testing_document" - } - ] - } - - - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} - - match: {docs.0.term_vectors.text.terms.brown.ttf: 2} - - - do: - termvectors.get_multi_termvectors: - "term_statistics" : true - "body" : { - "docs": [ - { - "_index" : "testidx", - "_type" : "testtype", - "_id" : "testing_document" - } - ] - } - - - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} - - match: {docs.0.term_vectors.text.terms.brown.ttf: 2} - - - do: - termvectors.get_multi_termvectors: - "term_statistics" : true - "index" : "testidx" - "body" : { - "docs": [ - { - "_type" : "testtype", - "_id" : "testing_document" - } - ] - } - - - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} - - match: {docs.0.term_vectors.text.terms.brown.ttf: 2} - - - do: - termvectors.get_multi_termvectors: - "term_statistics" : true - "index" : "testidx" - "type" : "testtype" - "body" : { - "docs": [ - { - "_id" : "testing_document" - } - ] - } - - - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} - - match: {docs.0.term_vectors.text.terms.brown.ttf: 2} - - - do: - termvectors.get_multi_termvectors: - "term_statistics" : true - "index" : "testidx" - "type" : "testtype" - "ids" : ["testing_document"] - - - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} - - match: {docs.0.term_vectors.text.terms.brown.ttf: 2} \ No newline at end of file