if you really want to use that API, you will need to create a java class to
put that code.
if all you want to do is to index text documents (that is all i want) there
is another solution.
i looked at the app that you mentioned ( scrutmydocs )
-
install glassfish
download glassfish server from
GlassFish
open terminal
go to download directory
Make the downloaded executable, by typing in:
chmod +x glassfish-3.0.1-unix-ml.sh
Run the script using the command
./glassfish-3.0.1-unix-ml.sh
i installed it in:
/usr/share/glassfishv3/bin/asadmin
tell the glassfish install program where your jdk is, mine (Ubuntu) was:
/usr/lib/jvm/java-6-openjdk-amd64/bin -
run glassfish
cd /usr/share/glassfishv3/bin
./asadmin start-domain domain1 -
install scrutmydocs
you can download the app as a war from
http://www.scrutmydocs.org/
go to
http://localhost:4848/common/index.jsf
deploy the app using the option on the left -
run scrutmydocs
http://localhost:8080/scrutmydocs-0.2.0/
once the app opens, load the docs (a button at upper-right)
then run a query and it works
Bye
2013/6/10 nyamka110@gmail.com
Hi Fatima, Thanks for your help, One question : Where do i put that codes
to create client etc.01//Create Client
02Settings settings = ImmutableSettings.settingsBuilder().put("
cluster.name","localtestsearch").build();
03TransportClient transportClient = new TransportClient(settings);
04transportClient = transportClient.addTransportAddress(new
InetSocketTransportAddress("localhost",9300));
05return (Client) transportClient;
06
07//Create Index and set settings and mappings
08
09CreateIndexRequestBuilder createIndexRequestBuilder =
client.admin().indices().prepareCreate(indexName);
10createIndexRequestBuilder.execute().actionGet();
11
12//Add documents
13IndexRequestBuilder indexRequestBuilder =
client().prepareIndex(indexName, documentType, documentId);
14//build json object
15XContentBuilder contentBuilder =
jsonBuilder().startObject().prettyPrint();
16contentBuilder.field("name", "jai");
17contentBuilder.stopObject();
18indexRequestBuilder.setSource(contentBuilder);
19IndexResponse response = indexRequestBuilder .execute().actionGet();
20
21//Get document
22GetRequestBuilder getRequestBuilder = client().prepareGet(indexName,
type, id);
23getRequestBuilder.setFields(new String{"name"});
24GetResponse response = getRequestBuilder.execute().actionGet();
25
...[Message tronqué]
--
Fátima Castiglione Maldonado
castiglionemaldonado@gmail.com
____
,'_ |
|||
< ) .------.
-----------,------.-' ,-' -.
| | | ,' . ,' | | ,' .
| ,-' | /
,'-' . ---.|_________
.--' -----. | _____________________ -. ----- | | ___| | | \ ,- \ | | ___| |===========================((|) | | | | | | _____________________/ - / |
--._ -----' | _________________,-' ----- | .-._ ,' __.---' | /
| -. | \ / . | | . ,' | | | . ,'
_____,------------------. -._ _,-' <___________________________) ------'
| | |
`.___|
=================================
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.