File tree Expand file tree Collapse file tree 1 file changed +23
-19
lines changed
src/Elasticsearch/Endpoints Expand file tree Collapse file tree 1 file changed +23
-19
lines changed Original file line number Diff line number Diff line change @@ -39,27 +39,31 @@ public function setBody($body)
39
39
public function getURI ()
40
40
{
41
41
if (isset ($ this ->index ) !== true ) {
42
- throw new Exceptions \RuntimeException (
43
- 'index is required for TermVectors '
44
- );
45
- }
46
- if (isset ($ this ->type ) !== true ) {
47
- throw new Exceptions \RuntimeException (
48
- 'type is required for TermVectors '
49
- );
50
- }
51
- if (isset ($ this ->id ) !== true ) {
52
- throw new Exceptions \RuntimeException (
53
- 'id is required for TermVectors '
54
- );
55
- }
42
+ throw new Exceptions \RuntimeException (
43
+ 'index is required for TermVectors '
44
+ );
45
+ }
46
+ if (isset ($ this ->type ) !== true ) {
47
+ throw new Exceptions \RuntimeException (
48
+ 'type is required for TermVectors '
49
+ );
50
+ }
51
+ if (isset ($ this ->id ) !== true && isset ($ this ->body ['doc ' ]) !== true ) {
52
+ throw new Exceptions \RuntimeException (
53
+ 'id or doc is required for TermVectors '
54
+ );
55
+ }
56
+
57
+ $ index = $ this ->index ;
58
+ $ type = $ this ->type ;
59
+ $ id = $ this ->id ;
60
+ $ uri = "/ $ index/ $ type/_termvectors " ;
56
61
57
- $ index = $ this ->index ;
58
- $ type = $ this ->type ;
59
- $ id = $ this ->id ;
60
- $ uri = "/ $ index/ $ type/ $ id/_termvectors " ;
62
+ if ($ id !== null ) {
63
+ $ uri = "/ $ index/ $ type/ $ id/_termvectors " ;
64
+ }
61
65
62
- return $ uri ;
66
+ return $ uri ;
63
67
}
64
68
65
69
/**
You can’t perform that action at this time.
0 commit comments