A google search for "elasticsearch java api" + feature didnt return
anything, so I just assumed.. my bad. Not that I'd have ever thought to
look for a Rest*IndexTemplateAction :D

I think I've tracked it down now though, thanks!

So if I set a template mapping for "_default_" as not analyzed, it will
make all indexes created with an explicit mapping be not analyzed, correct?
Then I could just set the particular indexes that need analysis (using
@Analyzed or similar in my class). Defaulting to not analyzed seems to make
sense, since most fields just need basic matching for property storage and
only things like names would need analysis.

Am I making a bad choice there? I'm assuming that using a dual mapping for
everything would double (or more) the total index size.




On Mon, Feb 10, 2014 at 6:08 PM, Alexander Reelsen <[email protected]> wrote:

> Hey,
>
> no, not at all... basically every REST/HTTP action is using the java API.
> What makes you think so?
> Just take a look at the RestGetIndexTemplateAction, and all the other
> Rest*IndexTemplateAction to see how it is wokring...
>
>
> --Alex
>
>
> On Mon, Feb 10, 2014 at 5:01 PM, Ryan Chazen <[email protected]> wrote:
>
>> Hey, thanks - that looks useful. I'm guessing there is no java api for it
>> though? It's like the java api devs went half way and then got bored.
>>
>>
>>
>> On Mon, Feb 10, 2014 at 2:59 PM, Alexander Reelsen <[email protected]>wrote:
>>
>>>  Hey,
>>>
>>> you may want to use index templates to make sure, that you do not have
>>> to check this stuff inside of your application and can just rely that the
>>> mappign is configured as expected, see
>>>
>>> See
>>> http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html
>>>
>>>
>>> --Alex
>>>
>>>
>>> On Sat, Feb 8, 2014 at 10:51 PM, Ryan Chazen <[email protected]> wrote:
>>>
>>>> OK Nevermind, I see how it's meant to be done now:
>>>>
>>>> On app start, check if the index exists already: if it doesn't create
>>>> it with the correct mappings
>>>> If it does, retrieve the mappings and compare. If they're wrong, update
>>>> it with a putmapping with the correct mappings.
>>>>
>>>> I'd guess that doing the mapping compares during data insert would be
>>>> very slow and it's why the API is set up this way. Makes sense.
>>>>
>>>> So only one question: is the "retrieve mappings and compare" step
>>>> necessary? If I always putmapping with the correct mappings, will it just
>>>> do nothing if they're already correct?
>>>>
>>>>
>>>>
>>>> On Saturday, February 8, 2014 11:30:56 PM UTC+2, Ryan Chazen wrote:
>>>>>
>>>>> Hey
>>>>>
>>>>> I'm inserting some documents using
>>>>>
>>>>> Map<String, Object> map = new HashMap<>();
>>>>> map.put("field1", "something");
>>>>> ...
>>>>> client.prepareIndex("a", "a").setSource(map).get();
>>>>>
>>>>>
>>>>> This inserts field1 as a text field with an analyzed index, but it's
>>>>> not actually text, just a string id or other data field. This is inside an
>>>>> ORM, so I'd like to have it set to use a not analyzed index automatically
>>>>> when inserting the data.
>>>>> I can't seem to find anything in the API for defining the mapping when
>>>>> indexing. Have I missed something? I'd prefer not to have to run a special
>>>>> mapping query after inserting the data as it would slow the ORM down to be
>>>>> constantly checking if indexes are analyzed or not...
>>>>>
>>>>>
>>>>>  --
>>>> 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 [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/elasticsearch/f890caf7-00ae-4f16-8e7b-e5ea1833a23a%40googlegroups.com
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "elasticsearch" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/elasticsearch/0x7VcpS9zGE/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9dVqEzjzOLgLR920O7s3QpO6R1bNGAPpH2X4qK4%3DXhJA%40mail.gmail.com
>>> .
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
>> 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 [email protected].
>>  To view this discussion on the web visit
>> https://groups.google.com/d/msgid/elasticsearch/CADawRD2dsjmgaGFZZ8g5LPW9RMd26bwqy%2BPyYZn7XZwMYtrU4Q%40mail.gmail.com
>> .
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "elasticsearch" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/elasticsearch/0x7VcpS9zGE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9TNHigQL4KBCY6StTJvFwH5BoF-wvOC6g3ZTCMSwRU7Q%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CADawRD3N5_buWTDOo_vSifmfgnZwqWVwKhovrBQgUYGNU3cOuw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to