Mapping for multiple types under one index


(sophia parafina) #1

Is there an example for mapping multiple geo_point types under one
index. I've searched the group for examples but all of them are for
single types and those work, but I can't get the correct syntax for
multiple types.

sophia


(Shay Banon) #2

You mean having several fields in the json of type geo_point? Something like
this: https://gist.github.com/1116858? If not, then gist the sample json you
want to map.

On Sun, Jul 31, 2011 at 4:17 PM, sophiap sophia.parafina@gmail.com wrote:

Is there an example for mapping multiple geo_point types under one
index. I've searched the group for examples but all of them are for
single types and those work, but I can't get the correct syntax for
multiple types.

sophia


(sophia parafina) #3

Hmmm, I think I don't understand what is meant by type, judging from
you example. I meant something like this https://gist.github.com/1116899

On Jul 31, 9:58 am, Shay Banon kim...@gmail.com wrote:

You mean having several fields in the json of type geo_point? Something like
this:https://gist.github.com/1116858?If not, then gist the sample json you
want to map.

On Sun, Jul 31, 2011 at 4:17 PM, sophiap sophia.paraf...@gmail.com wrote:

Is there an example for mapping multiple geo_point types under one
index. I've searched the group for examples but all of them are for
single types and those work, but I can't get the correct syntax for
multiple types.

sophia


(Shay Banon) #4

The mapping you gisted looks good, what is not working? Maybe you can gist a
sample of what does not work for you? (http://www.elasticsearch.org/help).

On Sun, Jul 31, 2011 at 6:48 PM, sophiap sophia.parafina@gmail.com wrote:

Hmmm, I think I don't understand what is meant by type, judging from
you example. I meant something like this https://gist.github.com/1116899

On Jul 31, 9:58 am, Shay Banon kim...@gmail.com wrote:

You mean having several fields in the json of type geo_point? Something
like
this:https://gist.github.com/1116858?If not, then gist the sample json
you
want to map.

On Sun, Jul 31, 2011 at 4:17 PM, sophiap sophia.paraf...@gmail.com
wrote:

Is there an example for mapping multiple geo_point types under one
index. I've searched the group for examples but all of them are for
single types and those work, but I can't get the correct syntax for
multiple types.

sophia


(sophia parafina) #5

Sorry, I should have attached the error I get when I save the mapping
to a file and register it.

curl -XPUT 'http://localhost:9200/geo/'

curl -XPUT http://localhost:9200/geo/_mapping -d map2.json

{"error":"ActionRequestValidationException[Validation Failed: 1:
mapping type is missing;]","status":500}

On Jul 31, 11:01 am, Shay Banon kim...@gmail.com wrote:

The mapping you gisted looks good, what is not working? Maybe you can gist a
sample of what does not work for you? (http://www.elasticsearch.org/help).

On Sun, Jul 31, 2011 at 6:48 PM, sophiap sophia.paraf...@gmail.com wrote:

Hmmm, I think I don't understand what is meant by type, judging from
you example. I meant something like thishttps://gist.github.com/1116899

On Jul 31, 9:58 am, Shay Banon kim...@gmail.com wrote:

You mean having several fields in the json of type geo_point? Something
like
this:https://gist.github.com/1116858?Ifnot, then gist the sample json
you
want to map.

On Sun, Jul 31, 2011 at 4:17 PM, sophiap sophia.paraf...@gmail.com
wrote:

Is there an example for mapping multiple geo_point types under one
index. I've searched the group for examples but all of them are for
single types and those work, but I can't get the correct syntax for
multiple types.

sophia


(jp.lorandi) #6

You're just missing the mapping type's name; your curl line should be:

curl -XPUT http://localhost:9200/geo/MYTYPE/_mapping -d map2.json

Also, afaik, if you're sending a file with -d, you need to prepend the name with @ thus

curl -XPUT http://localhost:9200/geo/MYTYPE/_mapping -d @map2.json

HTH,JP


-------- Original Message --------

Subject: Re: Mapping for multiple types under one index

From: sophiap <sophia.parafina@gmail.com>

Date: Sun, July 31, 2011 1:19 pm

To: elasticsearch <elasticsearch@googlegroups.com>

Sorry, I should have attached the error I get when I save the mapping

to a file and register it.

curl -XPUT 'http://localhost:9200/geo/'

curl -XPUT http://localhost:9200/geo/_mapping -d map2.json

{"error":"ActionRequestValidationException[Validation Failed: 1:

mapping type is missing;]","status":500}

On Jul 31, 11:01 am, Shay Banon <kim...@gmail.com> wrote:

> The mapping you gisted looks good, what is not working? Maybe you can gist a

> sample of what does not work for you? (http://www.elasticsearch.org/help).

>

>

>

>

>

>

>

> On Sun, Jul 31, 2011 at 6:48 PM, sophiap <sophia.paraf...@gmail.com> wrote:

> > Hmmm, I think I don't understand what is meant by type, judging from

> > you example. I meant something like thishttps://gist.github.com/1116899

>

> > On Jul 31, 9:58 am, Shay Banon <kim...@gmail.com> wrote:

> > > You mean having several fields in the json of type geo_point? Something

> > like

> > > this:https://gist.github.com/1116858?Ifnot, then gist the sample json

> > you

> > > want to map.

>

> > > On Sun, Jul 31, 2011 at 4:17 PM, sophiap <sophia.paraf...@gmail.com>

> > wrote:

> > > > Is there an example for mapping multiple geo_point types under one

> > > > index. I've searched the group for examples but all of them are for

> > > > single types and those work, but I can't get the correct syntax for

> > > > multiple types.

>

> > > > sophia


(sophia parafina) #7

Yes, this works if you are mapping only one type. But if you have two types,
you get this error:

curl -XPUT http://localhost:9200/geo/zipcode/_mapping -d @map2.json

{"error":"MapperParsingException[Mapping must have the type as the root
object]","status":400}

Is mapping two types possible with the REST API? Or do I do this via the
java API or through tire?

On Sun, Jul 31, 2011 at 11:25 AM, jp.lorandi@cfyar.com wrote:

You're just missing the mapping type's name; your curl line should be:

curl -XPUT http://localhost:9200/geo/MYTYPE/_mapping -d map2.json

Also, afaik, if you're sending a file with -d, you need to prepend the name
with @ thus

curl -XPUT http://localhost:9200/geo/MYTYPE/_mapping -d @map2.json

HTH,
JP

-------- Original Message --------
Subject: Re: Mapping for multiple types under one index
From: sophiap sophia.parafina@gmail.com
Date: Sun, July 31, 2011 1:19 pm
To: elasticsearch elasticsearch@googlegroups.com

Sorry, I should have attached the error I get when I save the mapping
to a file and register it.

curl -XPUT 'http://localhost:9200/geo/'

curl -XPUT http://localhost:9200/geo/_mapping -d map2.json

{"error":"ActionRequestValidationException[Validation Failed: 1:
mapping type is missing;]","status":500}

On Jul 31, 11:01 am, Shay Banon kim...@gmail.com wrote:

The mapping you gisted looks good, what is not working? Maybe you can
gist a
sample of what does not work for you? (http://www.elasticsearch.org/help
).

On Sun, Jul 31, 2011 at 6:48 PM, sophiap sophia.paraf...@gmail.com
wrote:

Hmmm, I think I don't understand what is meant by type, judging from
you example. I meant something like this
https://gist.github.com/1116899

On Jul 31, 9:58 am, Shay Banon kim...@gmail.com wrote:

You mean having several fields in the json of type geo_point?
Something

like

this:https://gist.github.com/1116858?Ifnot, then gist the sample
json

you

want to map.

On Sun, Jul 31, 2011 at 4:17 PM, sophiap sophia.paraf...@gmail.com
wrote:

Is there an example for mapping multiple geo_point types under one
index. I've searched the group for examples but all of them are for
single types and those work, but I can't get the correct syntax for
multiple types.

sophia


(jp.lorandi) #8

So you're trying to send 2 mappings on a single call?

-------- Original Message --------

Subject: Re: Mapping for multiple types under one index

From: sophia parafina <sophia.parafina@gmail.com>

Date: Sun, July 31, 2011 1:54 pm

To: elasticsearch@googlegroups.com

Yes, this works if you are mapping only one type. But if you have two types, you get this error:

curl -XPUT http://localhost:9200/geo/zipcode/_mapping -d @map2.json

{"error":"MapperParsingException[Mapping must have the type as the root object]","status":400}

Is mapping two types possible with the REST API? Or do I do this via the java API or through tire?

On Sun, Jul 31, 2011 at 11:25 AM, <jp.lorandi@cfyar.com> wrote:

You're just missing the mapping type's name; your curl line should be:

curl -XPUT http://localhost:9200/geo/MYTYPE/_mapping -d map2.json

Also, afaik, if you're sending a file with -d, you need to prepend the name with @ thus

curl -XPUT http://localhost:9200/geo/MYTYPE/_mapping -d @map2.json

HTH,JP

-------- Original Message --------

Subject: Re: Mapping for multiple types under one index

From: sophiap <sophia.parafina@gmail.com>

Date: Sun, July 31, 2011 1:19 pm

To: elasticsearch <elasticsearch@googlegroups.com>

Sorry, I should have attached the error I get when I save the mapping

to a file and register it.

curl -XPUT 'http://localhost:9200/geo/'

curl -XPUT http://localhost:9200/geo/_mapping -d map2.json

{"error":"ActionRequestValidationException[Validation Failed: 1:

mapping type is missing;]","status":500}

On Jul 31, 11:01 am, Shay Banon <kim...@gmail.com> wrote:

> The mapping you gisted looks good, what is not working? Maybe you can gist a

> sample of what does not work for you? (http://www.elasticsearch.org/help).

>

>

>

>

>

>

>

> On Sun, Jul 31, 2011 at 6:48 PM, sophiap <sophia.paraf...@gmail.com> wrote:

> > Hmmm, I think I don't understand what is meant by type, judging from

> > you example. I meant something like thishttps://gist.github.com/1116899

>

> > On Jul 31, 9:58 am, Shay Banon <kim...@gmail.com> wrote:

> > > You mean having several fields in the json of type geo_point? Something

> > like

> > > this:https://gist.github.com/1116858?Ifnot, then gist the sample json

> > you

> > > want to map.

>

> > > On Sun, Jul 31, 2011 at 4:17 PM, sophiap <sophia.paraf...@gmail.com>

> > wrote:

> > > > Is there an example for mapping multiple geo_point types under one

> > > > index. I've searched the group for examples but all of them are for

> > > > single types and those work, but I can't get the correct syntax for

> > > > multiple types.

>

> > > > sophia


(Shay Banon) #9

The mapping definition needs to include the type as the top level object,
for example: { "zipcode" : { .... } } for the zipcode type.

The Java API and the REST APIs have exactly the same capabilities.

On Sun, Jul 31, 2011 at 7:54 PM, sophia parafina
sophia.parafina@gmail.comwrote:

Yes, this works if you are mapping only one type. But if you have two
types, you get this error:

curl -XPUT http://localhost:9200/geo/zipcode/_mapping -d @map2.json

{"error":"MapperParsingException[Mapping must have the type as the root
object]","status":400}

Is mapping two types possible with the REST API? Or do I do this via the
java API or through tire?

On Sun, Jul 31, 2011 at 11:25 AM, jp.lorandi@cfyar.com wrote:

You're just missing the mapping type's name; your curl line should be:

curl -XPUT http://localhost:9200/geo/MYTYPE/_mapping -d map2.json

Also, afaik, if you're sending a file with -d, you need to prepend the
name with @ thus

curl -XPUT http://localhost:9200/geo/MYTYPE/_mapping -d @map2.json

HTH,
JP

-------- Original Message --------
Subject: Re: Mapping for multiple types under one index
From: sophiap sophia.parafina@gmail.com
Date: Sun, July 31, 2011 1:19 pm
To: elasticsearch elasticsearch@googlegroups.com

Sorry, I should have attached the error I get when I save the mapping
to a file and register it.

curl -XPUT 'http://localhost:9200/geo/'

curl -XPUT http://localhost:9200/geo/_mapping -d map2.json

{"error":"ActionRequestValidationException[Validation Failed: 1:
mapping type is missing;]","status":500}

On Jul 31, 11:01 am, Shay Banon kim...@gmail.com wrote:

The mapping you gisted looks good, what is not working? Maybe you can
gist a
sample of what does not work for you? (
http://www.elasticsearch.org/help).

On Sun, Jul 31, 2011 at 6:48 PM, sophiap sophia.paraf...@gmail.com
wrote:

Hmmm, I think I don't understand what is meant by type, judging from
you example. I meant something like this
https://gist.github.com/1116899

On Jul 31, 9:58 am, Shay Banon kim...@gmail.com wrote:

You mean having several fields in the json of type geo_point?
Something

like

this:https://gist.github.com/1116858?Ifnot, then gist the sample
json

you

want to map.

On Sun, Jul 31, 2011 at 4:17 PM, sophiap <sophia.paraf...@gmail.com

wrote:

Is there an example for mapping multiple geo_point types under
one

index. I've searched the group for examples but all of them are
for

single types and those work, but I can't get the correct syntax
for

multiple types.

sophia


(sophia parafina) #10

On Sun, Jul 31, 2011 at 12:00 PM, jp.lorandi@cfyar.com wrote:

So you're trying to send 2 mappings on a single call?

Yes, to the same index.

When I sent the first geo_point (place) mapping to the index and indexed the
data, it works perfectly. I am able to search using a distance filter, etc.

I then sent a second geo_point (zipcode) mapping to the same index and
elasticsearch returned and OK. I then indexed the second set of data.
However, when I use a distance filter, elastic search returns no hits for
the zipcode type, however querying on field works.

I would like to query one index by type with a distance filter.

-------- Original Message --------
Subject: Re: Mapping for multiple types under one index
From: sophia parafina sophia.parafina@gmail.com
Date: Sun, July 31, 2011 1:54 pm
To: elasticsearch@googlegroups.com

Yes, this works if you are mapping only one type. But if you have two
types, you get this error:

curl -XPUT http://localhost:9200/geo/zipcode/_mapping -d @map2.json

{"error":"MapperParsingException[Mapping must have the type as the root
object]","status":400}

Is mapping two types possible with the REST API? Or do I do this via the
java API or through tire?

On Sun, Jul 31, 2011 at 11:25 AM, jp.lorandi@cfyar.com wrote:

You're just missing the mapping type's name; your curl line should be:

curl -XPUT http://localhost:9200/geo/MYTYPE/_mapping -d map2.json

Also, afaik, if you're sending a file with -d, you need to prepend the
name with @ thus

curl -XPUT http://localhost:9200/geo/MYTYPE/_mapping -d @map2.json

HTH,
JP

-------- Original Message --------
Subject: Re: Mapping for multiple types under one index
From: sophiap sophia.parafina@gmail.com
Date: Sun, July 31, 2011 1:19 pm
To: elasticsearch elasticsearch@googlegroups.com

Sorry, I should have attached the error I get when I save the mapping
to a file and register it.

curl -XPUT 'http://localhost:9200/geo/'

curl -XPUT http://localhost:9200/geo/_mapping -d map2.json

{"error":"ActionRequestValidationException[Validation Failed: 1:
mapping type is missing;]","status":500}

On Jul 31, 11:01 am, Shay Banon kim...@gmail.com wrote:

The mapping you gisted looks good, what is not working? Maybe you can
gist a
sample of what does not work for you? (
http://www.elasticsearch.org/help).

On Sun, Jul 31, 2011 at 6:48 PM, sophiap sophia.paraf...@gmail.com
wrote:

Hmmm, I think I don't understand what is meant by type, judging from
you example. I meant something like this
https://gist.github.com/1116899

On Jul 31, 9:58 am, Shay Banon kim...@gmail.com wrote:

You mean having several fields in the json of type geo_point?
Something

like

this:https://gist.github.com/1116858?Ifnot, then gist the sample
json

you

want to map.

On Sun, Jul 31, 2011 at 4:17 PM, sophiap <sophia.paraf...@gmail.com

wrote:

Is there an example for mapping multiple geo_point types under
one

index. I've searched the group for examples but all of them are
for

single types and those work, but I can't get the correct syntax
for

multiple types.

sophia


(jp.lorandi) #11

You might want to PUT each mapping into ES via a separate cURL call. After that, index a record, then fetch the same mapping to verify that ES is using the mapping you specified and not guessing the type.

Finally, after all the above, if you could also gist the search whereby you're not getting results, that'd help lots.


-------- Original Message --------

Subject: Re: Mapping for multiple types under one index

From: sophia parafina <sophia.parafina@gmail.com>

Date: Sun, July 31, 2011 2:13 pm

To: elasticsearch@googlegroups.com

On Sun, Jul 31, 2011 at 12:00 PM, <jp.lorandi@cfyar.com> wrote:

So you're trying to send 2 mappings on a single call?

Yes, to the same index.

When I sent the first geo_point (place) mapping to the index and indexed the data, it works perfectly. I am able to search using a distance filter, etc.

I then sent a second geo_point (zipcode) mapping to the same index and elasticsearch returned and OK. I then indexed the second set of data. However, when I use a distance filter, elastic search returns no hits for the zipcode type, however querying on field works.

I would like to query one index by type with a distance filter.

-------- Original Message --------

Subject: Re: Mapping for multiple types under one index

From: sophia parafina <sophia.parafina@gmail.com>

Date: Sun, July 31, 2011 1:54 pm

To: elasticsearch@googlegroups.com

Yes, this works if you are mapping only one type. But if you have two types, you get this error:

curl -XPUT http://localhost:9200/geo/zipcode/_mapping -d @map2.json

{"error":"MapperParsingException[Mapping must have the type as the root object]","status":400}

Is mapping two types possible with the REST API? Or do I do this via the java API or through tire?

On Sun, Jul 31, 2011 at 11:25 AM, <jp.lorandi@cfyar.com> wrote:

You're just missing the mapping type's name; your curl line should be:

curl -XPUT http://localhost:9200/geo/MYTYPE/_mapping -d map2.json

Also, afaik, if you're sending a file with -d, you need to prepend the name with @ thus

curl -XPUT http://localhost:9200/geo/MYTYPE/_mapping -d @map2.json

HTH,JP

-------- Original Message --------

Subject: Re: Mapping for multiple types under one index

From: sophiap <sophia.parafina@gmail.com>

Date: Sun, July 31, 2011 1:19 pm

To: elasticsearch <elasticsearch@googlegroups.com>

Sorry, I should have attached the error I get when I save the mapping

to a file and register it.

curl -XPUT 'http://localhost:9200/geo/'

curl -XPUT http://localhost:9200/geo/_mapping -d map2.json

{"error":"ActionRequestValidationException[Validation Failed: 1:

mapping type is missing;]","status":500}

On Jul 31, 11:01 am, Shay Banon <kim...@gmail.com> wrote:

> The mapping you gisted looks good, what is not working? Maybe you can gist a

> sample of what does not work for you? (http://www.elasticsearch.org/help).

>

>

>

>

>

>

>

> On Sun, Jul 31, 2011 at 6:48 PM, sophiap <sophia.paraf...@gmail.com> wrote:

> > Hmmm, I think I don't understand what is meant by type, judging from

> > you example. I meant something like thishttps://gist.github.com/1116899

>

> > On Jul 31, 9:58 am, Shay Banon <kim...@gmail.com> wrote:

> > > You mean having several fields in the json of type geo_point? Something

> > like

> > > this:https://gist.github.com/1116858?Ifnot, then gist the sample json

> > you

> > > want to map.

>

> > > On Sun, Jul 31, 2011 at 4:17 PM, sophiap <sophia.paraf...@gmail.com>

> > wrote:

> > > > Is there an example for mapping multiple geo_point types under one

> > > > index. I've searched the group for examples but all of them are for

> > > > single types and those work, but I can't get the correct syntax for

> > > > multiple types.

>

> > > > sophia


(Shay Banon) #12

I think I see what you are trying to do now, you set the two types for the
mapping in the same put mapping request against a type. There is no put
mapping API to put several mappings, you need to do it per type. Another
option that you have is to provide the all mappings in the create index
API:
http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index.html
.

On Sun, Jul 31, 2011 at 8:13 PM, sophia parafina
sophia.parafina@gmail.comwrote:

On Sun, Jul 31, 2011 at 12:00 PM, jp.lorandi@cfyar.com wrote:

So you're trying to send 2 mappings on a single call?

Yes, to the same index.

When I sent the first geo_point (place) mapping to the index and indexed
the data, it works perfectly. I am able to search using a distance filter,
etc.

I then sent a second geo_point (zipcode) mapping to the same index and
elasticsearch returned and OK. I then indexed the second set of data.
However, when I use a distance filter, elastic search returns no hits for
the zipcode type, however querying on field works.

I would like to query one index by type with a distance filter.

-------- Original Message --------
Subject: Re: Mapping for multiple types under one index
From: sophia parafina sophia.parafina@gmail.com
Date: Sun, July 31, 2011 1:54 pm
To: elasticsearch@googlegroups.com

Yes, this works if you are mapping only one type. But if you have two
types, you get this error:

curl -XPUT http://localhost:9200/geo/zipcode/_mapping -d @map2.json

{"error":"MapperParsingException[Mapping must have the type as the root
object]","status":400}

Is mapping two types possible with the REST API? Or do I do this via the
java API or through tire?

On Sun, Jul 31, 2011 at 11:25 AM, jp.lorandi@cfyar.com wrote:

You're just missing the mapping type's name; your curl line should be:

curl -XPUT http://localhost:9200/geo/MYTYPE/_mapping -d map2.json

Also, afaik, if you're sending a file with -d, you need to prepend the
name with @ thus

curl -XPUT http://localhost:9200/geo/MYTYPE/_mapping -d @map2.json

HTH,
JP

-------- Original Message --------
Subject: Re: Mapping for multiple types under one index
From: sophiap sophia.parafina@gmail.com
Date: Sun, July 31, 2011 1:19 pm
To: elasticsearch elasticsearch@googlegroups.com

Sorry, I should have attached the error I get when I save the mapping
to a file and register it.

curl -XPUT 'http://localhost:9200/geo/'

curl -XPUT http://localhost:9200/geo/_mapping -d map2.json

{"error":"ActionRequestValidationException[Validation Failed: 1:
mapping type is missing;]","status":500}

On Jul 31, 11:01 am, Shay Banon kim...@gmail.com wrote:

The mapping you gisted looks good, what is not working? Maybe you can
gist a
sample of what does not work for you? (
http://www.elasticsearch.org/help).

On Sun, Jul 31, 2011 at 6:48 PM, sophiap sophia.paraf...@gmail.com
wrote:

Hmmm, I think I don't understand what is meant by type, judging from
you example. I meant something like this
https://gist.github.com/1116899

On Jul 31, 9:58 am, Shay Banon kim...@gmail.com wrote:

You mean having several fields in the json of type geo_point?
Something

like

this:https://gist.github.com/1116858?Ifnot, then gist the sample
json

you

want to map.

On Sun, Jul 31, 2011 at 4:17 PM, sophiap <sophia.paraf...
@gmail.com>

wrote:

Is there an example for mapping multiple geo_point types under
one

index. I've searched the group for examples but all of them are
for

single types and those work, but I can't get the correct syntax
for

multiple types.

sophia


(sophia parafina) #13

Thanks y'all. I walked through the process of setting the type mappings one
by one and it works. Not sure what I was doing wrong, but here's the working
process in gist: https://gist.github.com/1117013

sophia

On Sun, Jul 31, 2011 at 12:30 PM, Shay Banon kimchy@gmail.com wrote:

I think I see what you are trying to do now, you set the two types for the
mapping in the same put mapping request against a type. There is no put
mapping API to put several mappings, you need to do it per type. Another
option that you have is to provide the all mappings in the create index
API:
http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index.html
.

On Sun, Jul 31, 2011 at 8:13 PM, sophia parafina <
sophia.parafina@gmail.com> wrote:

On Sun, Jul 31, 2011 at 12:00 PM, jp.lorandi@cfyar.com wrote:

So you're trying to send 2 mappings on a single call?

Yes, to the same index.

When I sent the first geo_point (place) mapping to the index and indexed
the data, it works perfectly. I am able to search using a distance filter,
etc.

I then sent a second geo_point (zipcode) mapping to the same index and
elasticsearch returned and OK. I then indexed the second set of data.
However, when I use a distance filter, elastic search returns no hits for
the zipcode type, however querying on field works.

I would like to query one index by type with a distance filter.

-------- Original Message --------
Subject: Re: Mapping for multiple types under one index
From: sophia parafina sophia.parafina@gmail.com
Date: Sun, July 31, 2011 1:54 pm
To: elasticsearch@googlegroups.com

Yes, this works if you are mapping only one type. But if you have two
types, you get this error:

curl -XPUT http://localhost:9200/geo/zipcode/_mapping -d @map2.json

{"error":"MapperParsingException[Mapping must have the type as the root
object]","status":400}

Is mapping two types possible with the REST API? Or do I do this via the
java API or through tire?

On Sun, Jul 31, 2011 at 11:25 AM, jp.lorandi@cfyar.com wrote:

You're just missing the mapping type's name; your curl line should be:

curl -XPUT http://localhost:9200/geo/MYTYPE/_mapping -d map2.json

Also, afaik, if you're sending a file with -d, you need to prepend the
name with @ thus

curl -XPUT http://localhost:9200/geo/MYTYPE/_mapping -d @map2.json

HTH,
JP

-------- Original Message --------
Subject: Re: Mapping for multiple types under one index
From: sophiap sophia.parafina@gmail.com
Date: Sun, July 31, 2011 1:19 pm
To: elasticsearch elasticsearch@googlegroups.com

Sorry, I should have attached the error I get when I save the mapping
to a file and register it.

curl -XPUT 'http://localhost:9200/geo/'

curl -XPUT http://localhost:9200/geo/_mapping -d map2.json

{"error":"ActionRequestValidationException[Validation Failed: 1:
mapping type is missing;]","status":500}

On Jul 31, 11:01 am, Shay Banon kim...@gmail.com wrote:

The mapping you gisted looks good, what is not working? Maybe you can
gist a
sample of what does not work for you? (
http://www.elasticsearch.org/help).

On Sun, Jul 31, 2011 at 6:48 PM, sophiap sophia.paraf...@gmail.com
wrote:

Hmmm, I think I don't understand what is meant by type, judging from
you example. I meant something like this
https://gist.github.com/1116899

On Jul 31, 9:58 am, Shay Banon kim...@gmail.com wrote:

You mean having several fields in the json of type geo_point?
Something

like

this:https://gist.github.com/1116858?Ifnot, then gist the sample
json

you

want to map.

On Sun, Jul 31, 2011 at 4:17 PM, sophiap <sophia.paraf...
@gmail.com>

wrote:

Is there an example for mapping multiple geo_point types under
one

index. I've searched the group for examples but all of them are
for

single types and those work, but I can't get the correct syntax
for

multiple types.

sophia


(system) #14