crate / elasticsearch-inout-plugin

An Elasticsearch plugin which provides the ability to export data by query on server side.
Apache License 2.0
112 stars 15 forks source link

Search Into option of plugin giving error #47

Open starit1977 opened 11 years ago

starit1977 commented 11 years ago

Hi,

When i use search into option of plugin it gives me error.

local@pldsvv-07:/var/elasticsearch/elasticsearch-0.90.3$ curl -XPOST localhost:9200/test -d '{

"settings" : {
    "number_of_shards" : 1
},
"mappings" : {
    "type1" : {
        "_source" : { "enabled" : true },
        "properties" : {
            "field1" : { "type" : "string", "index" : "not_analyzed" }
        }
    }
}

}'^C local@pldsvv-07:/var/elasticsearch/elasticsearch-0.90.3$ local@pldsvv-07:/var/elasticsearch/elasticsearch-0.90.3$ local@pldsvv-07:/var/elasticsearch/elasticsearch-0.90.3$

local@pldsvv-07:/var/elasticsearch/elasticsearch-0.90.3$ local@pldsvv-07:/var/elasticsearch/elasticsearch-0.90.3$ local@pldsvv-07:/var/elasticsearch/elasticsearch-0.90.3$ curl -X POST 'http://localhost:9200/test/_search_into' -d '{ "fields": ["_id", "_source", ["_index", "'newtest'"]]}' {"writes":[],"total":0,"succeeded":0,"failed":0,"_shards":{"total":1,"successful":0,"failed":1,"failures":[{"index":"test","shard":0,"reason":"BroadcastShardOperationFailedException[[test][0] ]; nested: SearchParseException[[test][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{ \"fields\": [\"_id\", \"_source\", [\"_index\", \"newtest\"]]}]]]; nested: SearchParseException[[test][0]: from[-1],size[-1]: Parse Failure [SearchInto field [newtest] does not exist in the mapping]]; "}]}}

Then i thought to create the new indice, and try but same porblem.

local@pldsvv-07:/var/elasticsearch/elasticsearch-0.90.3$ curl -XPOST localhost:9200/newtest -d '{

"settings" : {
    "number_of_shards" : 1
},
"mappings" : {
    "type1" : {
        "_source" : { "enabled" : true },
        "properties" : {
            "field1" : { "type" : "string", "index" : "not_analyzed" }
        }
    }
}

}' {"ok":true,"acknowledged":true}

local@pldsvv-07:/var/elasticsearch/elasticsearch-0.90.3$ curl -X POST 'http://localhost:9200/test/_search_into' -d '{ "fields": ["_id", "_source", ["_index", "'newtest'"]]}' {"writes":[],"total":0,"succeeded":0,"failed":0,"_shards":{"total":1,"successful":0,"failed":1,"failures":[{"index":"test","shard":0,"reason":"BroadcastShardOperationFailedException[[test][0] ]; nested: SearchParseException[[test][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{ \"fields\": [\"_id\", \"_source\", [\"_index\", \"newtest\"]]}]]]; nested: SearchParseException[[test][0]: from[-1],size[-1]: Parse Failure [SearchInto field [newtest] does not exist in the mapping]]; "}]}}

Any idea of what's wrong?

Thanks Pranav.

starit1977 commented 11 years ago

any update on this?

mfussenegger commented 11 years ago

Hi,

I think shell escaping is the issue. Please try to write it like this:

'{ "fields": ["_id", "_source", ["_index", "''newtest''"]]}'

(1 double quote, 2 single quotes around newtest)

starit1977 commented 11 years ago

I still get the error -

local@pldsvv-07:/var/elasticsearch/elasticsearch-0.90.3$ curl -X POST 'http://localhost:9200/test/test/_search_into' -d '{ "fields": ["_id", "_source", ["_index", "''newtest''"]]}' {"writes":[],"total":0,"succeeded":0,"failed":0,"_shards":{"total":5,"successful":0,"failed":5,"failures":[{"index":"test","shard":0,"reason":"BroadcastShardOperationFailedException[[test][0] ]; nested: RemoteTransportException[[ExtraNode][inet[/10.3.176.141:9300]][el-crate-searchinto/s]]; nested: ActionNotFoundTransportException[No handler for action [el-crate-searchinto/s]]; "},{"index":"test","shard":1,"reason":"BroadcastShardOperationFailedException[[test][1] ]; nested: SearchParseException[[test][1]: from[-1],size[-1]: Parse Failure [Failed to parse source [{ \"fields\": [\"_id\", \"_source\", [\"_index\", \"newtest\"]]}]]]; nested: SearchParseException[[test][1]: from[-1],size[-1]: Parse Failure [SearchInto field [newtest] does not exist in the mapping]]; "},{"index":"test","shard":4,"reason":"BroadcastShardOperationFailedException[[test][4] ]; nested: RemoteTransportException[[ExtraNode][inet[/10.3.176.141:9300]][el-crate-searchinto/s]]; nested: ActionNotFoundTransportException[No handler for action [el-crate-searchinto/s]]; "},{"index":"test","shard":3,"reason":"BroadcastShardOperationFailedException[[test][3] ]; nested: RemoteTransportException[[52][inet[/10.3.176.22:9300]][el-crate-searchinto/s]]; nested: SearchParseException[[test][3]: from[-1],size[-1]: Parse Failure [Failed to parse source [{ \"fields\": [\"_id\", \"_source\", [\"_index\", \"newtest\"]]}]]]; nested: SearchParseException[[test][3]: from[-1],size[-1]: Parse Failure [SearchInto field [newtest] does not exist in the mapping]]; "},{"index":"test","shard":2,"reason":"BroadcastShardOperationFailedException[[test][2] ]; nested: RemoteTransportException[[51][inet[/10.3.176.140:9300]][el-crate-searchinto/s]]; nested: SearchParseException[[test][2]: from[-1],size[-1]: Parse Failure [Failed to parse source [{ \"fields\": [\"_id\", \"_source\", [\"_index\", \"newtest\"]]}]]]; nested: SearchParseException[[test][2]: from[-1],size[-1]: Parse Failure [SearchInto field [newtest] does not exist in the mapping]]; "}]}}local@pldsvv-07:/var/elasticsearch/elasticsearch-0.90.3$

starit1977 commented 11 years ago

any update here?

mfussenegger commented 11 years ago

what shell are you using? maybe the escaping does work differently on yours. I've tested it on zsh.

If I run it as you've posted in the first comment I get exactly the same errors. In your examples it thinks that "newtest" is a fieldname instead of a string literal. Once the escaping is fixed it works - we've also got a couple of tests that cover this functionality and all of them pass.