Skip to content

Commit 600b20e

Browse files
author
Olivier Favre
committed
Initial commit: import code from elastic/elasticsearch#2231
0 parents  commit 600b20e

23 files changed

+3125
-0
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/data
2+
/work
3+
/logs
4+
/.idea
5+
/target
6+
.DS_Store
7+
*.iml
8+
/.project
9+
/.settings
10+
/.classpath
11+
.*.swp

pom.xml

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<name>elasticsearch-action-updatebyquery</name>
6+
<description>
7+
The Update By Query feature, as an action plugin for ElasticSearch.
8+
</description>
9+
<inceptionYear>2013</inceptionYear>
10+
11+
<groupId>com.yakaz.elasticsearch.plugins</groupId>
12+
<artifactId>elasticsearch-action-updatebyquery</artifactId>
13+
<version>1.0.0-SNAPSHOT</version>
14+
<packaging>jar</packaging>
15+
16+
<url>http://github.com/yakaz/elasticsearch-action-updatebyquery</url>
17+
<scm>
18+
<connection>scm:git:[email protected]:yakaz/elasticsearch-action-updatebyquery.git</connection>
19+
<developerConnection>scm:git:[email protected]:yakaz/elasticsearch-action-updatebyquery.git</developerConnection>
20+
<url>https://github.com/yakaz/elasticsearch-action-updatebyquery.git</url>
21+
<tag>HEAD</tag>
22+
</scm>
23+
24+
<licenses>
25+
<license>
26+
<name>The Apache Software License, Version 2.0</name>
27+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
28+
<distribution>repo</distribution>
29+
</license>
30+
</licenses>
31+
32+
<developers>
33+
<developer>
34+
<id>ofavre</id>
35+
<name>Olivier Favre</name>
36+
<email>http://www.google.com/recaptcha/mailhide/d?k=01BFRL3yhSOUyxYhgio4AZrQ==&amp;c=MG8swJyru2wFd6B6QWz--HIx_5O38r35CjjdTzn025Q=</email>
37+
<timezone>+1</timezone>
38+
</developer>
39+
</developers>
40+
41+
<parent>
42+
<groupId>org.sonatype.oss</groupId>
43+
<artifactId>oss-parent</artifactId>
44+
<version>7</version>
45+
</parent>
46+
47+
<properties>
48+
<elasticsearch.version>0.20.0</elasticsearch.version>
49+
<lucene.version>3.6.1</lucene.version>
50+
</properties>
51+
52+
<dependencies>
53+
<!--dependency>
54+
<groupId>org.hamcrest</groupId>
55+
<artifactId>hamcrest-core</artifactId>
56+
<version>1.3</version>
57+
<scope>test</scope>
58+
</dependency>
59+
<dependency>
60+
<groupId>org.apache.lucene</groupId>
61+
<artifactId>lucene-test-framework</artifactId>
62+
<version>${lucene.version}</version>
63+
<scope>test</scope>
64+
</dependency>
65+
<dependency>
66+
<groupId>org.testng</groupId>
67+
<artifactId>testng</artifactId>
68+
<version>6.8</version>
69+
<scope>test</scope>
70+
</dependency-->
71+
<dependency>
72+
<groupId>org.elasticsearch</groupId>
73+
<artifactId>elasticsearch</artifactId>
74+
<version>${elasticsearch.version}</version>
75+
<scope>compile</scope>
76+
</dependency>
77+
</dependencies>
78+
79+
<build>
80+
<pluginManagement>
81+
<plugins>
82+
<plugin>
83+
<groupId>org.codehaus.mojo</groupId>
84+
<artifactId>cobertura-maven-plugin</artifactId>
85+
<version>2.5.1</version>
86+
</plugin>
87+
</plugins>
88+
</pluginManagement>
89+
90+
<plugins>
91+
<plugin>
92+
<groupId>org.apache.maven.plugins</groupId>
93+
<artifactId>maven-compiler-plugin</artifactId>
94+
<version>2.3.2</version>
95+
<configuration>
96+
<source>1.6</source>
97+
<target>1.6</target>
98+
</configuration>
99+
</plugin>
100+
<plugin>
101+
<groupId>org.apache.maven.plugins</groupId>
102+
<artifactId>maven-source-plugin</artifactId>
103+
<version>2.1.2</version>
104+
<executions>
105+
<execution>
106+
<id>attach-sources</id>
107+
<goals>
108+
<goal>jar</goal>
109+
</goals>
110+
</execution>
111+
</executions>
112+
</plugin>
113+
<plugin>
114+
<groupId>org.apache.maven.plugins</groupId>
115+
<artifactId>maven-javadoc-plugin</artifactId>
116+
<version>2.9</version>
117+
<configuration>
118+
<nohelp>true</nohelp>
119+
</configuration>
120+
<executions>
121+
<execution>
122+
<id>attach-javadoc</id>
123+
<goals>
124+
<goal>jar</goal>
125+
</goals>
126+
</execution>
127+
</executions>
128+
</plugin>
129+
<plugin>
130+
<artifactId>maven-assembly-plugin</artifactId>
131+
<version>2.3</version>
132+
<configuration>
133+
<appendAssemblyId>false</appendAssemblyId>
134+
<outputDirectory>${project.build.directory}/releases/</outputDirectory>
135+
<descriptors>
136+
<descriptor>${basedir}/src/main/assemblies/plugin.xml</descriptor>
137+
</descriptors>
138+
</configuration>
139+
<executions>
140+
<execution>
141+
<phase>package</phase>
142+
<goals>
143+
<goal>single</goal>
144+
</goals>
145+
</execution>
146+
</executions>
147+
</plugin>
148+
<plugin>
149+
<groupId>org.apache.maven.plugins</groupId>
150+
<artifactId>maven-release-plugin</artifactId>
151+
<version>2.4</version>
152+
<configuration>
153+
<tagNameFormat>v@{project.version}</tagNameFormat>
154+
</configuration>
155+
</plugin>
156+
157+
<plugin>
158+
<groupId>org.codehaus.mojo</groupId>
159+
<artifactId>cobertura-maven-plugin</artifactId>
160+
<version>2.5.1</version>
161+
</plugin>
162+
<plugin>
163+
<groupId>org.apache.maven.plugins</groupId>
164+
<artifactId>maven-surefire-plugin</artifactId>
165+
<version>2.11</version>
166+
<executions>
167+
<execution>
168+
<!-- This is unexpectedly necessary to run both TestNG and JUnit tests... -->
169+
<phase>test</phase>
170+
<goals>
171+
<goal>test</goal>
172+
</goals>
173+
<configuration>
174+
<testNGArtifactName>none:none</testNGArtifactName>
175+
</configuration>
176+
</execution>
177+
</executions>
178+
</plugin>
179+
</plugins>
180+
</build>
181+
182+
<reporting>
183+
<plugins>
184+
<plugin>
185+
<groupId>org.codehaus.mojo</groupId>
186+
<artifactId>cobertura-maven-plugin</artifactId>
187+
<version>2.5.1</version>
188+
</plugin>
189+
</plugins>
190+
</reporting>
191+
192+
<profiles>
193+
<profile>
194+
<id>release-sign-artifacts</id>
195+
<activation>
196+
<property>
197+
<name>performRelease</name>
198+
<value>true</value>
199+
</property>
200+
</activation>
201+
<build>
202+
<plugins>
203+
<plugin>
204+
<groupId>org.apache.maven.plugins</groupId>
205+
<artifactId>maven-gpg-plugin</artifactId>
206+
<executions>
207+
<execution>
208+
<id>sign-artifacts</id>
209+
<phase>verify</phase>
210+
<goals>
211+
<goal>sign</goal>
212+
</goals>
213+
</execution>
214+
</executions>
215+
</plugin>
216+
</plugins>
217+
</build>
218+
</profile>
219+
</profiles>
220+
221+
</project>
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
* Licensed to ElasticSearch and Shay Banon under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. ElasticSearch licenses this
6+
* file to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.elasticsearch.action.updatebyquery;
21+
22+
import org.elasticsearch.ElasticSearchIllegalArgumentException;
23+
24+
/**
25+
* Specifies how bulk responses that have been created based on the documents that have matched with the update query
26+
* are returned in the response.
27+
*/
28+
public enum BulkResponseOption {
29+
30+
/**
31+
* Bulk responses aren't included in the response.
32+
*/
33+
NONE((byte) 0),
34+
35+
/**
36+
* Only failed bulk responses are included in the response.
37+
*/
38+
FAILED((byte) 1),
39+
40+
/**
41+
* All bulk responses are included in the response.
42+
*/
43+
ALL((byte) 2);
44+
45+
private byte id;
46+
47+
private BulkResponseOption(byte id) {
48+
this.id = id;
49+
}
50+
51+
/**
52+
* The internal representation of the operation type.
53+
*/
54+
public byte id() {
55+
return id;
56+
}
57+
58+
/**
59+
* Constructs the bulk response option from its internal representation.
60+
*/
61+
public static BulkResponseOption fromId(byte id) {
62+
if (id == 0) {
63+
return NONE;
64+
} else if (id == 1) {
65+
return FAILED;
66+
} else if (id == 2) {
67+
return ALL;
68+
} else {
69+
throw new ElasticSearchIllegalArgumentException("No type match for [" + id + "]");
70+
}
71+
}
72+
73+
/**
74+
* Parse the bulk response option from string.
75+
*/
76+
public static BulkResponseOption fromString(String type) {
77+
if ("none".equals(type)) {
78+
return NONE;
79+
} else if ("failed".equals(type)) {
80+
return FAILED;
81+
} else if ("all".equals(type)) {
82+
return ALL;
83+
}
84+
throw new ElasticSearchIllegalArgumentException("no response type match for [" + type + "], should be either `none`, `failed` or `all`");
85+
}
86+
87+
}

0 commit comments

Comments
 (0)